Package org.apache.lucene.search

Examples of org.apache.lucene.search.Query


    {
      logger.error(e.getMessage(), e);
      hits = new BrowseHit[0];
    }
   
    Query q = req.getQuery();
    if (q == null){
      q = new MatchAllDocsQuery();
    }
    if (req.isShowExplanation()){
      for (BrowseHit hit : hits){
View Full Code Here


    logger.debug("Start SearchTermSuggestion. q = " + getQ()
        + " keywords size: " + keywords.size());
    if (q != null && searchTermSuggestion != null) {   
      TermQuery termQuery = null;
      QueryParser parser = new QueryParser(DocumentCreator.FIELD_TEXT,DocumentCreator.createDocumentAnalyzer());
      Query query = null;
      try{
        query = parser.parse(q);
      }catch(Exception e){
        logger.debug("QueryParser error: " + e);
      }
View Full Code Here

        try {
          final List<INews> matchingNews = new ArrayList<INews>(3);

          /* Perform Query */
          Query query = ModelSearchQueries.createQuery(filter.getSearch());
          searcher[0].search(query, new HitCollector() {
            @Override
            public void collect(int doc, float score) {
              try {
                Document document = searcher[0].doc(doc);
View Full Code Here

    ISearchField field = fFactory.createSearchField(INews.LOCATION, fNewsEntityName);
    List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();
    conditions.add(fFactory.createSearchCondition(field, SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(root))));

    Query query = ModelSearchQueries.createQuery(conditions, false);
    assertNotNull(query);

    BooleanQuery.setMaxClauseCount(maxClauseCount);
  }
View Full Code Here

  //*-- test the expansion of a query
  public void ttestExpandQuery()
  {
   System.out.println("Started testExpandQuery");
   String seQuery = "this is a sample query";
   Query query = null;
   try { query = SearchTools.expandQuery(seQuery); }
   catch (IOException ie) { System.out.println("IO Exception " + ie.getMessage() ); }
   System.out.println(" Original query: " + seQuery);
   System.out.println(" Expanded  query: " + query);
   System.out.println("Finished testExpandQuery");
View Full Code Here

  //*-- test the fetch of similar documents
  public void ttestSimilarDocs()
  {
   System.out.println("Started testSimilarDocs");
   String docKey = "/home/manuk/html/cacr_html/webnet/node4.html";
   Query query = SearchTools.similarDocs(docKey, dbt);
   System.out.println(" Expanded  query: " + query);
   System.out.println("Finished testSimilarDocs");
  }
View Full Code Here

    Occur occur = getOccur(condition.getSpecifier(), matchAllConditions);
    return new BooleanClause(allFieldsQuery, occur);
  }

  private BooleanClause createBooleanClause(ISearchCondition condition, boolean matchAllConditions) throws IOException {
    Query query = null;

    /* Separately handle this dynamic Query */
    if (condition.getField().getId() == INews.AGE_IN_DAYS)
      query = createAgeClause(condition);

View Full Code Here

        clause = createAllNewsFieldsClause(analyzer, condition, matchAllConditions);
      else
        clause = createBooleanClause(analyzer, condition, matchAllConditions);

      /* Check if the Clause has any valid Query */
      Query query = clause.getQuery();
      if (query instanceof BooleanQuery && ((BooleanQuery) query).clauses().isEmpty())
        continue;

      /*
       * Specially treat this case where the specifier is a negation but any of
View Full Code Here

    return false;
  }

  private static BooleanClause createBooleanClause(Analyzer analyzer, ISearchCondition condition, boolean matchAllConditions) throws IOException {
    Query query = null;

    /* Separately handle this dynamic Query */
    if (condition.getField().getId() == INews.AGE_IN_DAYS || condition.getField().getId() == INews.AGE_IN_MINUTES)
      query = createAgeClause(condition);

View Full Code Here

  private List<SearchHit<NewsReference>> doSearchNews(Collection<ISearchCondition> conditions, boolean matchAllConditions) throws PersistenceException {

    /* Perform the search */
    try {
      Query bQuery = ModelSearchQueries.createQuery(conditions, matchAllConditions);

      /* Make sure the searcher is in sync */
      final IndexSearcher currentSearcher = getCurrentSearcher();
      final List<SearchHit<NewsReference>> resultList = new ArrayList<SearchHit<NewsReference>>();
      final Map<Long, Long> searchResultNewsIds = new HashMap<Long, Long>();
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.Query

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.