📄 classxapian_1_1enquire.tex
字号:
\index{Xapian::Enquire@{Xapian::Enquire}!set_collapse_key@{set\_\-collapse\_\-key}}\index{set_collapse_key@{set\_\-collapse\_\-key}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-collapse\_\-key]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-collapse\_\-key (\hyperlink{types_8h_f24564a367ebbc8f80cf9a1dbd1e81fd}{Xapian::valueno} {\em collapse\_\-key})}}\label{classXapian_1_1Enquire_b5ef9cc615f7dd8414175c7529ee4e0c}Set the collapse key to use for queries. \begin{Desc}\item[Parameters:]\begin{description}\item[{\em collapse\_\-key}]value number to collapse on - at most one mset entry with each particular value will be returned.\end{description}\end{Desc}The entry returned will be the best entry with that particular value (highest weight or highest sorting key).An example use might be to create a value for each document containing an MD5 hash of the document contents. Then duplicate documents from different sources can be eliminated at search time (it's better to eliminate duplicates at index time, but this may not be always be possible - for example the search may be over more than one \hyperlink{namespaceXapian}{Xapian} database).Another use is to group matches in a particular category (e.g. you might collapse a mailing list search on the Subject: so that there's only one result per discussion thread). In this case you can use get\_\-collapse\_\-count() to give the user some idea how many other results there are. And if you index the Subject: as a boolean term as well as putting it in a value, you can offer a link to a non-collapsed search restricted to that thread using a boolean filter.(default is \hyperlink{types_8h_f24564a367ebbc8f80cf9a1dbd1e81fd}{Xapian::valueno}(-1) which means no collapsing). \hypertarget{classXapian_1_1Enquire_dadaa8401e40ab4cec090bc1541a11b7}{\index{Xapian::Enquire@{Xapian::Enquire}!set_cutoff@{set\_\-cutoff}}\index{set_cutoff@{set\_\-cutoff}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-cutoff]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-cutoff (\hyperlink{types_8h_d9213278aaed43f1ab0110c87a6b7476}{Xapian::percent} {\em percent\_\-cutoff}, \hyperlink{types_8h_167860ee249b702eb746dca0d245f808}{Xapian::weight} {\em weight\_\-cutoff} = {\tt 0})}}\label{classXapian_1_1Enquire_dadaa8401e40ab4cec090bc1541a11b7}Set the percentage and/or weight cutoffs. \begin{Desc}\item[Parameters:]\begin{description}\item[{\em percent\_\-cutoff}]Minimum percentage score for returned documents. If a document has a lower percentage score than this, it will not appear in the mset. If your intention is to return only matches which contain all the terms in the query, then it's more efficient to use \hyperlink{classXapian_1_1Query_7e7b6b8ad0c915c2364578dfaaf6100bb99aad2dfc85eccc56163bc65eb0fdda}{Xapian::Query::OP\_\-AND} instead of \hyperlink{classXapian_1_1Query_7e7b6b8ad0c915c2364578dfaaf6100bc50e54f3dd9dc59dab7daa2c50cf631b}{Xapian::Query::OP\_\-OR} in the query than to use set\_\-cutoff(100). (default 0 =$>$ no percentage cut-off). \item[{\em weight\_\-cutoff}]Minimum weight for a document to be returned. If a document has a lower score that this, it will not appear in the mset. It is usually only possible to choose an appropriate weight for cutoff based on the results of a previous run of the same query; this is thus mainly useful for alerting operations. The other potential use is with a user specified weighting scheme. (default 0 =$>$ no weight cut-off). \end{description}\end{Desc}\hypertarget{classXapian_1_1Enquire_bbf7ff734ff6adcb301e493f6eed803b}{\index{Xapian::Enquire@{Xapian::Enquire}!set_docid_order@{set\_\-docid\_\-order}}\index{set_docid_order@{set\_\-docid\_\-order}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-docid\_\-order]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-docid\_\-order (docid\_\-order {\em order})}}\label{classXapian_1_1Enquire_bbf7ff734ff6adcb301e493f6eed803b}Set the direction in which documents are ordered by document id in the returned \hyperlink{classXapian_1_1MSet}{MSet}. This order only has an effect on documents which would otherwise have equal rank. For a weighted probabilistic match with no sort value, this means documents with equal weight. For a boolean match, with no sort value, this means all documents. And if a sort value is used, this means documents with equal sort value (and also equal weight if ordering on relevance after the sort).\begin{Desc}\item[Parameters:]\begin{description}\item[{\em order}]This can be:\begin{itemize}\item Xapian::Enquire::ASCENDING docids sort in ascending order (default)\item Xapian::Enquire::DESCENDING docids sort in descending order\item Xapian::Enquire::DONT\_\-CARE docids sort in whatever order is most efficient for the backend\end{itemize}\end{description}\end{Desc}Note: If you add documents in strict date order, then a boolean search - i.e. set\_\-weighting\_\-scheme(Xapian::Bool\-Weight()) - with set\_\-docid\_\-order(Xapian::Enquire::DESCENDING) is a very efficient way to perform \char`\"{}sort by date, newest first\char`\"{}. \hypertarget{classXapian_1_1Enquire_1148d960120662e5543e2a2b12620318}{\index{Xapian::Enquire@{Xapian::Enquire}!set_query@{set\_\-query}}\index{set_query@{set\_\-query}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-query]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-query (const \hyperlink{classXapian_1_1Query}{Xapian::Query} \& {\em query}, \hyperlink{types_8h_6979d98ebbe67186bd31e5ee2a7585cb}{Xapian::termcount} {\em qlen} = {\tt 0})}}\label{classXapian_1_1Enquire_1148d960120662e5543e2a2b12620318}Set the query to run. \begin{Desc}\item[Parameters:]\begin{description}\item[{\em query}]the new query to run. \item[{\em qlen}]the query length to use in weight calculations - by default the sum of the wqf of all terms is used. \end{description}\end{Desc}\hypertarget{classXapian_1_1Enquire_80a33a28791c05167204706c1a9d986b}{\index{Xapian::Enquire@{Xapian::Enquire}!set_sort_by_relevance@{set\_\-sort\_\-by\_\-relevance}}\index{set_sort_by_relevance@{set\_\-sort\_\-by\_\-relevance}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-sort\_\-by\_\-relevance]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-sort\_\-by\_\-relevance ()}}\label{classXapian_1_1Enquire_80a33a28791c05167204706c1a9d986b}Set the sorting to be by relevance only. \hypertarget{classXapian_1_1Enquire_f24f34e6671c42f5120431f6a81f8404}{\index{Xapian::Enquire@{Xapian::Enquire}!set_sort_by_relevance_then_value@{set\_\-sort\_\-by\_\-relevance\_\-then\_\-value}}\index{set_sort_by_relevance_then_value@{set\_\-sort\_\-by\_\-relevance\_\-then\_\-value}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-sort\_\-by\_\-relevance\_\-then\_\-value]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-sort\_\-by\_\-relevance\_\-then\_\-value (\hyperlink{types_8h_f24564a367ebbc8f80cf9a1dbd1e81fd}{Xapian::valueno} {\em sort\_\-key}, bool {\em ascending} = {\tt true})}}\label{classXapian_1_1Enquire_f24f34e6671c42f5120431f6a81f8404}Set the sorting to be by relevance then value. Note that with the default BM25 weighting scheme parameters, non-identical documents will rarely have the same weight, so this setting will give very similar results to \hyperlink{classXapian_1_1Enquire_80a33a28791c05167204706c1a9d986b}{set\_\-sort\_\-by\_\-relevance()}. It becomes more useful with particular BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom weighting schemes.\begin{Desc}\item[Parameters:]\begin{description}\item[{\em sort\_\-key}]value number to reorder on. Sorting is with a string compare. If ascending is true (the default) higher is better; if ascending is false, lower is better.\item[{\em ascending}]If true, documents values which sort higher by string compare are better. If false, the sort order is reversed. (default true) \end{description}\end{Desc}\hypertarget{classXapian_1_1Enquire_cc00543ba0459cc8ceca25e89fe69e19}{\index{Xapian::Enquire@{Xapian::Enquire}!set_sort_by_value@{set\_\-sort\_\-by\_\-value}}\index{set_sort_by_value@{set\_\-sort\_\-by\_\-value}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-sort\_\-by\_\-value]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-sort\_\-by\_\-value (\hyperlink{types_8h_f24564a367ebbc8f80cf9a1dbd1e81fd}{Xapian::valueno} {\em sort\_\-key}, bool {\em ascending} = {\tt true})}}\label{classXapian_1_1Enquire_cc00543ba0459cc8ceca25e89fe69e19}Set the sorting to be by value only. \begin{Desc}\item[Parameters:]\begin{description}\item[{\em sort\_\-key}]value number to reorder on. Sorting is with a string compare. If ascending is true (the default) higher is better; if ascending is false, lower is better.\item[{\em ascending}]If true, documents values which sort higher by string compare are better. If false, the sort order is reversed. (default true) \end{description}\end{Desc}\hypertarget{classXapian_1_1Enquire_9d30933e61e605d2745af701ae9d829d}{\index{Xapian::Enquire@{Xapian::Enquire}!set_sort_by_value_then_relevance@{set\_\-sort\_\-by\_\-value\_\-then\_\-relevance}}\index{set_sort_by_value_then_relevance@{set\_\-sort\_\-by\_\-value\_\-then\_\-relevance}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-sort\_\-by\_\-value\_\-then\_\-relevance]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-sort\_\-by\_\-value\_\-then\_\-relevance (\hyperlink{types_8h_f24564a367ebbc8f80cf9a1dbd1e81fd}{Xapian::valueno} {\em sort\_\-key}, bool {\em ascending} = {\tt true})}}\label{classXapian_1_1Enquire_9d30933e61e605d2745af701ae9d829d}Set the sorting to be by value, then by relevance for documents with the same value. \begin{Desc}\item[Parameters:]\begin{description}\item[{\em sort\_\-key}]value number to reorder on. Sorting is with a string compare. If ascending is true (the default) higher is better; if ascending is false, lower is better.\item[{\em ascending}]If true, documents values which sort higher by string compare are better. If false, the sort order is reversed. (default true) \end{description}\end{Desc}\hypertarget{classXapian_1_1Enquire_d5c72e6f34c5c2da5f0b8c79736704ab}{\index{Xapian::Enquire@{Xapian::Enquire}!set_weighting_scheme@{set\_\-weighting\_\-scheme}}\index{set_weighting_scheme@{set\_\-weighting\_\-scheme}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[set\_\-weighting\_\-scheme]{\setlength{\rightskip}{0pt plus 5cm}void Xapian::Enquire::set\_\-weighting\_\-scheme (const \hyperlink{classXapian_1_1Weight}{Weight} \& {\em weight\_\-})}}\label{classXapian_1_1Enquire_d5c72e6f34c5c2da5f0b8c79736704ab}Set the weighting scheme to use for queries. \begin{Desc}\item[Parameters:]\begin{description}\item[{\em weight\_\-}]the new weighting scheme. If no weighting scheme is specified, the default is BM25 with the default parameters. \end{description}\end{Desc}\hypertarget{classXapian_1_1Enquire_d6b752a7d15eb88d58dd8c90cafd4250}{\index{Xapian::Enquire@{Xapian::Enquire}!XAPIAN_DEPRECATED@{XAPIAN\_\-DEPRECATED}}\index{XAPIAN_DEPRECATED@{XAPIAN\_\-DEPRECATED}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[XAPIAN\_\-DEPRECATED]{\setlength{\rightskip}{0pt plus 5cm}Xapian::Enquire::XAPIAN\_\-DEPRECATED (void {\em set\_\-sorting}(Xapian::valueno sort\_\-key, int sort\_\-bands, bool sort\_\-by\_\-relevance=false))}}\label{classXapian_1_1Enquire_d6b752a7d15eb88d58dd8c90cafd4250}For compatibility with \hyperlink{namespaceXapian}{Xapian} 0.8.5 and earlier. \begin{Desc}\item[\hyperlink{deprecated__deprecated000005}{Deprecated}]This method is now deprecated, use \hyperlink{classXapian_1_1Enquire_80a33a28791c05167204706c1a9d986b}{set\_\-sort\_\-by\_\-relevance()}, \hyperlink{classXapian_1_1Enquire_cc00543ba0459cc8ceca25e89fe69e19}{set\_\-sort\_\-by\_\-value()}, or \hyperlink{classXapian_1_1Enquire_9d30933e61e605d2745af701ae9d829d}{set\_\-sort\_\-by\_\-value\_\-then\_\-relevance()} instead.\end{Desc}set\_\-sorting(KEY, 1) -$>$ set\_\-sort\_\-by\_\-value(KEY)set\_\-sorting(KEY, 1, false) -$>$ set\_\-sort\_\-by\_\-value(KEY)set\_\-sorting(KEY, 1, true) -$>$ set\_\-sort\_\-by\_\-value\_\-then\_\-relevance(KEY)set\_\-sorting(ANYTHING, 0) -$>$ \hyperlink{classXapian_1_1Enquire_80a33a28791c05167204706c1a9d986b}{set\_\-sort\_\-by\_\-relevance()}set\_\-sorting(\hyperlink{types_8h_f24564a367ebbc8f80cf9a1dbd1e81fd}{Xapian::valueno}(-1), ANYTHING) -$>$ \hyperlink{classXapian_1_1Enquire_80a33a28791c05167204706c1a9d986b}{set\_\-sort\_\-by\_\-relevance()} \hypertarget{classXapian_1_1Enquire_ebcd04916dbfa6af02a2b1354ebfc701}{\index{Xapian::Enquire@{Xapian::Enquire}!XAPIAN_DEPRECATED@{XAPIAN\_\-DEPRECATED}}\index{XAPIAN_DEPRECATED@{XAPIAN\_\-DEPRECATED}!Xapian::Enquire@{Xapian::Enquire}}\subsubsection[XAPIAN\_\-DEPRECATED]{\setlength{\rightskip}{0pt plus 5cm}Xapian::Enquire::XAPIAN\_\-DEPRECATED (void {\em set\_\-sort\_\-forward}(bool sort\_\-forward))}}\label{classXapian_1_1Enquire_ebcd04916dbfa6af02a2b1354ebfc701}For compatibility with \hyperlink{namespaceXapian}{Xapian} 0.8.5 and earlier. \begin{Desc}\item[\hyperlink{deprecated__deprecated000004}{Deprecated}]This method is now deprecated, use \hyperlink{classXapian_1_1Enquire_bbf7ff734ff6adcb301e493f6eed803b}{set\_\-docid\_\-order()} instead - set\_\-sort\_\-forward(true) -$>$ set\_\-docid\_\-order(ASCENDING) and set\_\-sort\_\-forward(false) -$>$ set\_\-docid\_\-order(DESCENDING). \end{Desc}The documentation for this class was generated from the following file:\begin{CompactItemize}\item include/xapian/\hyperlink{enquire_8h}{enquire.h}\end{CompactItemize}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -