Package net.sf.katta.lib.lucene

Examples of net.sf.katta.lib.lucene.LuceneClient.search()


    final ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("foo: bar");
    long start = System.currentTimeMillis();
    for (int i = 0; i < 10000; i++) {
      client.search(query, new String[] { "index2", "index1" });
    }
    System.out.println("search took: " + (System.currentTimeMillis() - start));

    start = System.currentTimeMillis();
    for (int i = 0; i < 10000; i++) {
View Full Code Here


    // shutdown proxy of node1
    _miniCluster.getNode(0).getRpcServer().stop();

    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    System.out.println("=========================");
    assertSearchResults(10, luceneClient.search(query, new String[] { INDEX_NAME }, 10));
    assertEquals(937, luceneClient.count(query, new String[] { INDEX_NAME }));
    assertSearchResults(10, luceneClient.search(query, new String[] { INDEX_NAME }, 10));
    assertEquals(937, luceneClient.count(query, new String[] { INDEX_NAME }));
    // search 2 time to ensure we get all availible nodes
    System.out.println("=========================");
View Full Code Here

    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    System.out.println("=========================");
    assertSearchResults(10, luceneClient.search(query, new String[] { INDEX_NAME }, 10));
    assertEquals(937, luceneClient.count(query, new String[] { INDEX_NAME }));
    assertSearchResults(10, luceneClient.search(query, new String[] { INDEX_NAME }, 10));
    assertEquals(937, luceneClient.count(query, new String[] { INDEX_NAME }));
    // search 2 time to ensure we get all availible nodes
    System.out.println("=========================");
    _miniCluster.shutdownNode(0);
    luceneClient.close();
View Full Code Here

  public void testGetDetails_NodeProxyDownAfterClientInitialization() throws Exception {
    deployTestIndices(1, getNodeCount());
    LuceneClient luceneClient = new LuceneClient(_miniCluster.getZkConfiguration());
    ((NodeProxyManager) luceneClient.getClient().getProxyManager()).setSuccessiveProxyFailuresBeforeReestablishing(1);
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    Hits hits = luceneClient.search(query, new String[] { INDEX_NAME }, 10);

    // shutdown proxy of node1
    System.out.println("=========================");
    if (_miniCluster.getNode(0).getName().equals(hits.getHits().get(0).getNode())) {
      _miniCluster.shutdownNodeRpc(0);
View Full Code Here

      _miniCluster.shutdownNodeRpc(i);
    }

    System.out.println("=========================");
    try {
      luceneClient.search(query, new String[] { INDEX_NAME }, 10);
      fail("should throw exception");
    } catch (ShardAccessException e) {
      // expected
    }
    System.out.println("=========================");
View Full Code Here

      } catch (Exception e) {
        logException("undeploy", e);
      }

      try {
        Hits search = luceneClient.search(query, new String[] { "*" });
        LOG.info(runThroughs + ": got " + search.size() + " results");
      } catch (Exception e) {
        logException("search", e);
      }
      Thread.sleep(5000);
View Full Code Here

    int listenerCountBeforeDeploys = _protocol.getRegisteredListenerCount();
    deployClient.addIndex("newIndex1", INDEX_FILE.getAbsolutePath(), 1).joinDeployment();
    deployClient.addIndex("newIndex2", INDEX_FILE.getAbsolutePath(), 1).joinDeployment();
    deployClient.addIndex("newIndex3", INDEX_FILE.getAbsolutePath(), 1).joinDeployment();
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    client.search(query, new String[] { "newIndex1" }, 10);

    deployClient.removeIndex("newIndex1");
    deployClient.removeIndex("newIndex2");
    deployClient.removeIndex("newIndex3");
    Thread.sleep(2000);
View Full Code Here

  @Test
  public void testGetDetails() throws Exception {
    deployTestIndices(1, 1);
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    final Hits hits = client.search(query, new String[] { INDEX_NAME }, 10);
    assertNotNull(hits);
    assertEquals(10, hits.getHits().size());
    for (final Hit hit : hits.getHits()) {
      final MapWritable details = client.getDetails(hit);
      final Set<Writable> keySet = details.keySet();
View Full Code Here

  @Test
  public void testGetDetailsWithFieldNames() throws Exception {
    deployTestIndices(1, 1);
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    final Hits hits = client.search(query, new String[] { INDEX_NAME }, 10);
    assertNotNull(hits);
    assertEquals(10, hits.getHits().size());
    for (final Hit hit : hits.getHits()) {
      final MapWritable details = client.getDetails(hit, new String[] { "path" });
      final Set<Writable> keySet = details.keySet();
View Full Code Here

    assertEquals(IndexState.DEPLOYED, indexState);

    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse(textFieldName + ": "
            + textFieldContent);
    final Hits hits = client.search(query, new String[] { index.getName() }, 10);
    assertNotNull(hits);
    assertEquals(1, hits.getHits().size());
    final Hit hit = hits.getHits().get(0);
    final MapWritable details = client.getDetails(hit);
    final Set<Writable> keySet = details.keySet();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.