Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.KeywordAnalyzer


  @Test
  public void testCount() 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 int count = client.count(query, new String[] { INDEX_NAME });
    assertEquals(937, count);
    client.close();
  }
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);
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" });
View Full Code Here

    IndexState indexState = deployClient.addIndex(index.getName(), index.getParentFile().getAbsolutePath(), 1)
            .joinDeployment();
    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);
View Full Code Here

  @Test
  public void testGetDetailsConcurrently() throws KattaException, ParseException, InterruptedException {
    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());
    List<MapWritable> detailList = client.getDetails(hits.getHits());
    assertEquals(hits.getHits().size(), detailList.size());
View Full Code Here

  @Test
  public void testSearch() throws Exception {
    deploy3Indices();
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("foo: bar");
    final Hits hits = client.search(query, new String[] { INDEX3, INDEX2 });
    assertNotNull(hits);
    for (final Hit hit : hits.getHits()) {
      writeToLog(hit);
    }
View Full Code Here

    // query and compare results
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    Sort sort = new Sort(new SortField[] { new SortField("timesort", SortField.LONG) });

    // query both documents
    Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("text:ab*");
    Hits hits = client.search(query, new String[] { indexName }, 20, sort);
    assertEquals(2, hits.size());

    // query only one document
    query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("text:abc2");
    hits = client.search(query, new String[] { indexName }, 20, sort);
    assertEquals(1, hits.size());

    // query only one document on one node
    _miniCluster.shutdownNode(0);
    TestUtil.waitUntilIndexBalanced(_protocol, indexName);
    query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("text:abc2");
    hits = client.search(query, new String[] { indexName }, 20, sort);
    assertEquals(1, hits.size());
    client.close();
  }
View Full Code Here

            .joinDeployment();
    assertEquals(IndexState.DEPLOYED, indexState);

    // query and compare results
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse(textFieldName + ": "
            + queryTerm);
    Sort sort = new Sort(new SortField[] { new SortField("sortField", SortField.INT) });
    final Hits hits = client.search(query, new String[] { sortIndex.getName() }, 20, sort);
    assertNotNull(hits);
    List<Hit> hitsList = hits.getHits();
View Full Code Here

  @Test
  public void testSearchLimit() throws Exception {
    deploy3Indices();
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("foo: bar");
    final Hits hits = client.search(query, new String[] { INDEX3, INDEX2 }, 1);
    assertNotNull(hits);
    for (final Hit hit : hits.getHits()) {
      writeToLog(hit);
    }
View Full Code Here

  }

  @Test
  public void testKatta20SearchLimitMaxNumberOfHits() throws Exception {
    deployTestIndices(1, getNodeCount());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("foo: bar");
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Hits expectedHits = client.search(query, new String[] { INDEX_NAME }, 4);
    assertNotNull(expectedHits);
    LOG.info("Expected hits:");
    for (final Hit hit : expectedHits.getHits()) {
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.