Epinova / Epinova.Elasticsearch

A search-plugin for Episerver CMS and Commerce
MIT License
29 stars 20 forks source link

Add simple querystring search #130

Closed zarnor closed 3 years ago

zarnor commented 3 years ago

Add SimpleQuerystringSearch() method to allow using elastics simple_query_sring syntax.

Simple query string reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html

Example:

SearchResult result = service
   .SimpleQuerystringSearch<ArticlePage>("(bacon | ham) melt -cheese")
   .GetResults();

Allowed operators can be limited with allowedOperations parameter:

SearchResult result = service
   .SimpleQuerystringSearch<ArticlePage>("\"bacon melt\" sandwi*",
      defaultOperator: Operator.And,
      allowedOperators:
         SimpleQuerystringOperators.Prefix |
         SimpleQuerystringOperators.Phrase);
    )
   .GetResults();
otanum commented 3 years ago

Release 11.7.3.163 @zarnor