Class SearchService

java.lang.Object
org.ctan.site.services.search.base.IndexingBase
org.ctan.site.services.search.SearchService

public class SearchService extends IndexingBase
The class SearchingService implements a service to perform a full-text search.

Configuration

This service can be configured via the global Grails configuration file grails-app/conf/Config.groovy. The following configuration items are recognized:
ctan.search.directory
This configuration item contains the absolute path to the directory in which the sub-directories for the Lucene index files reside.
  • Constructor Details

  • Method Details

    • find

      public QueryContainer find(@NonNull @NonNull QueryContainer query) throws org.apache.lucene.index.CorruptIndexException, IOException, org.apache.lucene.queryparser.classic.ParseException
      Perform a query.
      Parameters:
      query - the query
      Returns:
      the query container
      Throws:
      IOException - in case of an I/O error
      org.apache.lucene.index.CorruptIndexException - in case of an error
      org.apache.lucene.queryparser.classic.ParseException - in case of an error
    • recommendations

      public List<SearchService.RecommendationTo> recommendations(String packageName, String locale, int maxNumber) throws org.apache.lucene.index.CorruptIndexException, IOException
      This method retrieves a list of recommendations for a given package. The list contains a transport object for each hit with the following entries:
      path
      The path to the package description
      display
      The short name of the package
      title
      The title – currently in English
      score
      The score as float.
      Parameters:
      packageName - the name of the base package
      locale - the language
      maxNumber - the maximal number results to be returned
      Returns:
      the list of recommendations
      Throws:
      IOException - in case of an I/O error
      org.apache.lucene.index.CorruptIndexException - in case of an error