Package net.sf.regain.search

Examples of net.sf.regain.search.IndexSearcherManager


    IndexConfig[] configArr = SearchToolkit.getIndexConfigArr(request);
    String[] fieldValues;
    if (configArr.length == 1) {
      // We have only one index -> Get the field values
      IndexConfig config = configArr[0];
      IndexSearcherManager manager = IndexSearcherManager.getInstance(config.getDirectory());
      fieldValues = manager.getFieldValues(fieldName);
    } else {
      // We have multiple indexes -> Get the values of each index and merge them
      HashSet valueSet = new HashSet();
      for (int i = 0; i < configArr.length; i++) {
        IndexSearcherManager manager = IndexSearcherManager.getInstance(configArr[i].getDirectory());
        String[] currFieldValues = manager.getFieldValues(fieldName);
        for (int j = 0; j < currFieldValues.length; j++) {
          valueSet.add(currFieldValues[j]);
        }
      }
View Full Code Here


   */
  @Override
  public void highlightHitDocument(int index) throws RegainException {

    try {
      IndexSearcherManager manager = IndexSearcherManager.getInstance(mIndexConfig.getDirectory());
      // The highlighter needs a rewritten query to work with wildcard and fuzzy queries
      Query rewrittenQuery = manager.rewrite(mQuery);
      QueryScorer queryScorer = new QueryScorer(rewrittenQuery);
      // End added by Anders

      Highlighter highlighter = new Highlighter(
              new SimpleHTMLFormatter("<span class=\"highlight\">", "</span>"), queryScorer);
View Full Code Here

      // Get the index size
      long size = RegainToolkit.getDirectorySize(currentIndexDir);
      String sizeAsString = RegainToolkit.bytesToString(size, request.getLocale());
     
      // Get the document count
      IndexSearcherManager manager = IndexSearcherManager.getInstance(config.getDirectory());
      int docCount = manager.getDocumentCount();
     
      // Print the results
      response.print(localizer.msg("indexInfo", "Last update: {0}<br/>Size: {1}<br/>Document count: {2}",
          lastUpdate, sizeAsString, new Integer(docCount)));
    } else {
View Full Code Here

TOP

Related Classes of net.sf.regain.search.IndexSearcherManager

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.