C# Класс Lucene.Net.QueryParsers.Flexible.Standard.QueryParserUtil

This class defines utility methods to (help) parse query strings into Query objects.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Escape ( string s ) : string

Returns a string where those characters that TextParser expects to be escaped are escaped by a preceding \.

Parse ( string queries, string fields, Analyzer analyzer ) : Query

Parses a query which searches on the fields specified. If x fields are specified, this effectively constructs: (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)

Parse ( string query, string fields, BooleanClause flags, Analyzer analyzer ) : Query

Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited. Usage: string[] fields = {"filename", "contents", "description"}; BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD, BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT}; MultiFieldQueryParser.Parse("query", fields, flags, analyzer); The code above would construct a query: (filename:query) +(contents:query) -(description:query)

Описание методов

Escape() публичный статический Метод

Returns a string where those characters that TextParser expects to be escaped are escaped by a preceding \.
public static Escape ( string s ) : string
s string
Результат string

Parse() публичный статический Метод

Parses a query which searches on the fields specified. If x fields are specified, this effectively constructs: (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)
/// if the length of the queries array differs from the length of the /// fields array ///
public static Parse ( string queries, string fields, Analyzer analyzer ) : Query
queries string Queries strings to parse
fields string Fields to search on
analyzer Lucene.Net.Analysis.Analyzer Analyzer to use
Результат Lucene.Net.Search.Query

Parse() публичный статический Метод

Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited. Usage: string[] fields = {"filename", "contents", "description"}; BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD, BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT}; MultiFieldQueryParser.Parse("query", fields, flags, analyzer); The code above would construct a query: (filename:query) +(contents:query) -(description:query)
/// if the length of the fields array differs from the length of the /// flags array ///
public static Parse ( string query, string fields, BooleanClause flags, Analyzer analyzer ) : Query
query string Query string to parse
fields string Fields to search on
flags Lucene.Net.Search.BooleanClause Flags describing the fields
analyzer Lucene.Net.Analysis.Analyzer Analyzer to use
Результат Lucene.Net.Search.Query