/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { String } from "../../types/java/lang/String"; import type { List } from "../../types/java/util/List"; import type { SearchResult } from "../../types/senselogic/sitevision/api/search/SearchResult"; /** *

* Convenience interface for querying the default index. *

* *
*

* Note! This interface contains convenience methods for basic search in the default index. * When more powerful search behaviour is needed - use {@link senselogic.sitevision.api.search.searcher.Searcher} instead! * Actually, you can always use Searcher, but not always SearchUtil. *

*

* Examples of when you must use {@link senselogic.sitevision.api.search.searcher.Searcher} instead is: *

* *
* *

* Query syntax note! Query strings should be expressed according to the Solr query syntax. * The syntax is basically the * * Lucene query syntax with some minor differences (solr syntax allows open-ended range queries and pure negative queries). * Also note that a general recommendation is to always use the prefix operators (+/-) instead of the * boolean keywords (AND/OR/NOT) to avoid unexpected behaviour. For deeper understanding, see for example * Why Not AND, OR, And NOT?. *

* *

* An instance of the Sitevision class implementing this interface can be obtained via {@link senselogic.sitevision.api.Utils#getSearchUtil()}. * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface. *

* @author Mikael Wikblom * @since Sitevision 2.6_06 * @see senselogic.sitevision.api.search.searcher.Searcher */ export interface SearchUtil { /** *

* Searches the default index using the multi-field ("edismax") parser. *

* *

* Here is a simple example written in server-side javascript: *

*

   *  var searchUtil = request.getAttribute("sitevision.utils").getSearchUtil();
   *  var result = searchUtil.search("test*", null, 0, 10);
   *  if (result.hasHits()) {
   *     out.println("Approximate hit count: " + result.getApproximateCount() + "<br/>");
   *     var hits = result.getHits();
   *     while (hits.hasNext()) {
   *        var hit = hits.next();
   *        out.print("<a href=\"" + hit.getField('uri') + "\" title=\"\">");
   *        out.print(hit.getField('title'));
   *        out.print("</a>");
   *        out.println("<br>");
   *     }
   *  } else {
   *     out.println("No hits for query = '" + result.getQuery() + "'<br>");
   *  }
   *  
* *

* Note! aQuery will be stripped from Local params, * see {@link senselogic.sitevision.api.search.query.QueryStringUtil#stripLocalParams(String)}. *

* @param aQuery The search query according to the Solr query syntax * @param sortFields A List of {@link SearchSortField} objects. May be null. * @param aStartAtHit number of leading hits to be skipped * @param aMaxHitsToReturn maximum total number of hits to be returned * @return The search returns a {@link SearchResult} and is never null */ search( aQuery: String | string, sortFields: List | unknown[], aStartAtHit: number, aMaxHitsToReturn: number ): SearchResult; /** *

* Searches the default index using the single-field ("standard") parser with a specified default field. *

* *

* Note! aQuery will be stripped from Local params, * see {@link senselogic.sitevision.api.search.query.QueryStringUtil#stripLocalParams(String)}. *

* @param aQuery The search query according to the Solr query syntax * @param aFieldName name of the field that should be queried * @param sortFields A List of {@link SearchSortField} objects. May be null. * @param aStartAtHit number of leading hits to be skipped * @param aMaxHitsToReturn maximum total number of hits to be returned * @return a {@link SearchResult} and is never null * @since Sitevision 2.7_06 * @since Sitevision 3.0 */ search( aQuery: String | string, aFieldName: String | string, sortFields: List | unknown[], aStartAtHit: number, aMaxHitsToReturn: number ): SearchResult; } declare namespace SearchUtil {} declare var searchUtil: SearchUtil; export default searchUtil;