Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.KeywordAnalyzer


  private void checkQueryResults(IndexSearcher indexSearcher, String kattaIndexName, String fieldName,
          String queryTerm, int resultCount, Sort sort) throws Exception {

    // final Query query = new QueryParser("", new
    // KeywordAnalyzer()).parse(fieldName + ": " + queryTerm);
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse(fieldName + ": "
            + queryTerm);
    final TopDocs searchResultsLucene;
    final Hits searchResultsKatta;
    if (sort == null) {
      searchResultsLucene = indexSearcher.search(query, resultCount);
View Full Code Here


    LuceneClient luceneClient = new LuceneClient(_miniCluster.getZkConfiguration());

    // 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 }));
View Full Code Here

  @Test
  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())) {
View Full Code Here

  @Test
  public void testAllNodeProxyDownAfterClientInitialization() throws Exception {
    deployTestIndices(1, getNodeCount());
    LuceneClient luceneClient = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    for (int i = 0; i < _miniCluster.getRunningNodeCount(); i++) {
      _miniCluster.shutdownNodeRpc(i);
    }

    System.out.println("=========================");
View Full Code Here

          client = new LuceneClient();
        } else {
          client = _client;
        }
        while (!_stopped) {
          final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("foo:bar");
          Hits hits = client.search(query, new String[] { "*" });
          _firedQueryCount++;
          if (hits.size() != _expectedTotalHitCount) {
            _unexpectedResultCount++;
            LOG.error("expected " + _expectedTotalHitCount + " hits but got " + hits.size());
View Full Code Here

      }
    };
  }

  protected Query parseQuery(String queryString) throws ParseException {
    QueryParser parser = new QueryParser(Version.LUCENE_30, "field", new KeywordAnalyzer());
    return parser.parse(queryString);
  }
View Full Code Here

    _client = null;
  }

  @Override
  public void execute(NodeContext nodeContext, String queryString) throws Exception {
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse(queryString);
    _client.search(query, _indices, _count);
  }
View Full Code Here

  public static void main(String[] args) throws Exception {
    LuceneClient luceneClient = new LuceneClient();
    ZkConfiguration zkConfig = new ZkConfiguration();
    DeployClient deployClient = new DeployClient(ZkKattaUtil.startZkClient(zkConfig, 60000), zkConfig);

    QueryParser parser = new QueryParser(Version.LUCENE_30, "field", new KeywordAnalyzer());
    Query query = parser.parse("foo: b*");

    int runThroughs = 2;
    while (true) {
      try {
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");
View Full Code Here

    for (Node node : nodes) {
      TestUtil.waitUntilNodeServesShards(_protocol, node.getName(), SHARD_COUNT);
    }
    Thread.sleep(2000);

    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    client.count(query, new String[] { INDEX_NAME });
    client.close();
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.KeywordAnalyzer

Copyright © 2018 www.massapicom. 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.