You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@solr.apache.org by "Manahan, Rhoden Mark B. - US" <rh...@caci.com.INVALID> on 2023/08/07 13:17:10 UTC

FOLLOW-UP: Exploring SOLR (Some Questions on Text Search Features)

Hi,

We have not gotten any response yet from our email below.

Appreciate if you could look into this and provide some information to support our exploration of its Full-Text Search capabilities.

Thanks,

Rhoden Manahan
202.725.5518

From: Manahan, Rhoden Mark B. - US
Sent: Tuesday, July 25, 2023 3:51 PM
To: users@solr.apache.org
Subject: Some Questions on SOLR's Text Search Features

Hi,

We are currently trying to explore Apache SOLR and trying to get the feel of its fulltext-search capabilities.

We have the following and currently used Oracle Text CONTAINS Query Operators (reference<https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ccref/oracle-text-CONTAINS-query-operators.html#GUID-6410B783-FC9A-4C99-B3AF-9E0349AA43D1>) to support our application's text search capabilities and wondering if SOLR supports them as well. Appreciate any information that you could share to support our exploration.

=====================================================================================
MINUS (-)
Use the MINUS operator to lower the score of documents that contain unwanted noise terms. MINUS is useful when you want to search for documents that contain one query term but want the presence of a second term to cause a document to be ranked lower.
Syntax
Syntax
Description
term1-term2
term1 minus term2
Returns documents that contain term1. Calculates score by subtracting the score of term2 from the score of term1. Only documents with positive score are returned.
Example for MINUS Operator
Suppose a query on the term cars always returned high scoring documents about Ford cars. You can lower the scoring of the Ford documents by using the expression:
Copy
'cars - Ford'
In essence, this expression returns documents that contain the term cars and possibly Ford. However, the score for a returned document is the score of cars minus the score of Ford.
=====================================================================================
NEAR (;)

Use the NEAR operator to return a score based on the proximity of two or more query terms. Oracle Text returns higher scores for terms closer together and lower scores for terms farther apart in a document. If a word or term appears more than once in a NEAR query, then the word must appear more than once in the document in order to match.

Note:

The NEAR operator works with only word queries. You cannot use NEAR in ABOUT queries.

Syntax

Copy

NEAR((word1,word2,...,wordn) [, max_span [, order [, maxreqd]]])
=====================================================================================
ABOUT

General Behavior

Use the ABOUT operator to return documents that are related to a query term or phrase. In English and French, ABOUT enables you to query on concepts, even if a concept is not actually part of a query. For example, an ABOUT query on heat might return documents related to temperature, even though the term temperature is not part of the query.
=====================================================================================
Narrower Term (NT, NTG, NTP, NTI)

Use the narrower term operators (NT, NTG, NTP, NTI) to expand a query to include all the terms that have been defined in a thesaurus as the narrower or lower level terms for a specified term. They can also expand the query to include all of the narrower terms for each narrower term, and so on down through the thesaurus hierarchy.
=====================================================================================
Translation Term (TR)
Use the translation term operator (TR) to expand a query to include all defined foreign language equivalent terms.
Syntax
Syntax
Description
TR(term[, lang, [thes]])
Expands term to include all the foreign equivalents that are defined for term.
=====================================================================================
Translation Term Synonym (TRSYN)
Use the translation term synonym operator (TRSYN) to expand a query to include all the defined foreign equivalents of the query term, the synonyms of query term, and the foreign equivalents of the synonyms.
Syntax
Syntax
Description
TRSYN(term[, lang, [thes]])
Expands term to include foreign equivalents of term, the synonyms of term, and the foreign equivalents of the synonyms.
=====================================================================================
Broader Term (BT, BTG, BTP, BTI)

Use the broader term operators (BT, BTG, BTP, BTI) to expand a query to include the term that has been defined in a thesaurus as the broader or higher level term for a specified term. They can also expand the query to include the broader term for the broader term and the broader term for that broader term, and so on up through the thesaurus hierarchy.
=====================================================================================
Preferred Term (PT)
Use the preferred term operator (PT) to replace a term in a query with the preferred term that has been defined in a thesaurus for the term.
Syntax
Syntax
Description
PT(term[,thes])
Replaces the specified word in a query with the preferred term for term.
=====================================================================================
Related Term (RT)
Use the related term operator (RT) to expand a query to include all related terms that have been defined in a thesaurus for the term.
Syntax
Syntax
Description
RT(term[,thes])
Expands a query to include all the terms defined in the thesaurus as a related term for term.
=====================================================================================
WITHIN
Use the WITHIN operator to narrow a query down into document sections. Document sections can be one of the following:

  *   Zone sections
  *   Field sections
  *   Attribute sections
  *   Special sections (sentence or paragraph)
Syntax
Syntax
Description
expression WITHIN section
Searches for expression within the predefined zone, field, or attribute section.
If section is a zone, expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
If section is a field or attribute section, expression cannot contain another WITHIN operator.
expression WITHIN SENTENCE
Searches for documents that contain expression within a sentence. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
expression WITHIN PARAGRAPH
Searches for documents that contain expression within a paragraph. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
=====================================================================================



Regards,
Rhoden

________________________________

This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.

Exploring SOLR (Some Questions on Text Search Features)

Posted by "Manahan, Rhoden Mark B. - US" <rh...@caci.com.INVALID>.
Hi,

We are currently trying to explore Apache SOLR and trying to get the feel of its fulltext-search capabilities.

We have the following and currently used Oracle Text CONTAINS Query Operators (reference<https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ccref/oracle-text-CONTAINS-query-operators.html#GUID-6410B783-FC9A-4C99-B3AF-9E0349AA43D1>) to support our application's text search capabilities and wondering if SOLR supports them as well. Appreciate any information that you could share to support our exploration.

=====================================================================================
MINUS (-)
Use the MINUS operator to lower the score of documents that contain unwanted noise terms. MINUS is useful when you want to search for documents that contain one query term but want the presence of a second term to cause a document to be ranked lower.
Syntax
Syntax
Description
term1-term2
term1 minus term2
Returns documents that contain term1. Calculates score by subtracting the score of term2 from the score of term1. Only documents with positive score are returned.
Example for MINUS Operator
Suppose a query on the term cars always returned high scoring documents about Ford cars. You can lower the scoring of the Ford documents by using the expression:
Copy
'cars - Ford'
In essence, this expression returns documents that contain the term cars and possibly Ford. However, the score for a returned document is the score of cars minus the score of Ford.
=====================================================================================
NEAR (;)

Use the NEAR operator to return a score based on the proximity of two or more query terms. Oracle Text returns higher scores for terms closer together and lower scores for terms farther apart in a document. If a word or term appears more than once in a NEAR query, then the word must appear more than once in the document in order to match.

Note:

The NEAR operator works with only word queries. You cannot use NEAR in ABOUT queries.

Syntax

Copy

NEAR((word1,word2,...,wordn) [, max_span [, order [, maxreqd]]])
=====================================================================================
ABOUT

General Behavior

Use the ABOUT operator to return documents that are related to a query term or phrase. In English and French, ABOUT enables you to query on concepts, even if a concept is not actually part of a query. For example, an ABOUT query on heat might return documents related to temperature, even though the term temperature is not part of the query.
=====================================================================================
Narrower Term (NT, NTG, NTP, NTI)

Use the narrower term operators (NT, NTG, NTP, NTI) to expand a query to include all the terms that have been defined in a thesaurus as the narrower or lower level terms for a specified term. They can also expand the query to include all of the narrower terms for each narrower term, and so on down through the thesaurus hierarchy.
=====================================================================================
Translation Term (TR)
Use the translation term operator (TR) to expand a query to include all defined foreign language equivalent terms.
Syntax
Syntax
Description
TR(term[, lang, [thes]])
Expands term to include all the foreign equivalents that are defined for term.
=====================================================================================
Translation Term Synonym (TRSYN)
Use the translation term synonym operator (TRSYN) to expand a query to include all the defined foreign equivalents of the query term, the synonyms of query term, and the foreign equivalents of the synonyms.
Syntax
Syntax
Description
TRSYN(term[, lang, [thes]])
Expands term to include foreign equivalents of term, the synonyms of term, and the foreign equivalents of the synonyms.
=====================================================================================
Broader Term (BT, BTG, BTP, BTI)

Use the broader term operators (BT, BTG, BTP, BTI) to expand a query to include the term that has been defined in a thesaurus as the broader or higher level term for a specified term. They can also expand the query to include the broader term for the broader term and the broader term for that broader term, and so on up through the thesaurus hierarchy.
=====================================================================================
Preferred Term (PT)
Use the preferred term operator (PT) to replace a term in a query with the preferred term that has been defined in a thesaurus for the term.
Syntax
Syntax
Description
PT(term[,thes])
Replaces the specified word in a query with the preferred term for term.
=====================================================================================
Related Term (RT)
Use the related term operator (RT) to expand a query to include all related terms that have been defined in a thesaurus for the term.
Syntax
Syntax
Description
RT(term[,thes])
Expands a query to include all the terms defined in the thesaurus as a related term for term.
=====================================================================================
WITHIN
Use the WITHIN operator to narrow a query down into document sections. Document sections can be one of the following:

  *   Zone sections
  *   Field sections
  *   Attribute sections
  *   Special sections (sentence or paragraph)
Syntax
Syntax
Description
expression WITHIN section
Searches for expression within the predefined zone, field, or attribute section.
If section is a zone, expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
If section is a field or attribute section, expression cannot contain another WITHIN operator.
expression WITHIN SENTENCE
Searches for documents that contain expression within a sentence. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
expression WITHIN PARAGRAPH
Searches for documents that contain expression within a paragraph. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
=====================================================================================



Regards,
Rhoden

________________________________

This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.

Re: FOLLOW-UP: Exploring SOLR (Some Questions on Text Search Features)

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello, Rhoden.
TLDR - No.
Longer version.
minus and must_not - goes for free, check the guide. However, in solr they
are too restrictive, they literally subtract unwanted term from result.
If you wish to bury some term it should go like
(+foo +bar)^10 OR (+foo -bar)
or just
+foo^100 bar^0.001

https://solr.apache.org/guide/6_6/the-standard-query-parser.html#TheStandardQueryParser-ProximitySearches
goes as is, but again you need to combine it for bury behavior.

Regarding taxonomies it's a subject for custom query parser development.

Within requires special demarcation - there are no sentence nor paragraph
abstraction out-of the box. Then, from my experience it may be handled via
*custom* Lucene Interval. Note, that lucene's intervals are not avalable in
Solr beside of https://github.com/mkhludnev/solr-flexible-qparser
prototype.

Good Luck!


On Mon, Aug 7, 2023 at 5:02 PM Manahan, Rhoden Mark B. - US
<rh...@caci.com.invalid> wrote:

> Hi,
>
> We have not gotten any response yet from our email below.
>
> Appreciate if you could look into this and provide some information to
> support our exploration of its Full-Text Search capabilities.
>
> Thanks,
>
> Rhoden Manahan
> 202.725.5518
>
> From: Manahan, Rhoden Mark B. - US
> Sent: Tuesday, July 25, 2023 3:51 PM
> To: users@solr.apache.org
> Subject: Some Questions on SOLR's Text Search Features
>
> Hi,
>
> We are currently trying to explore Apache SOLR and trying to get the feel
> of its fulltext-search capabilities.
>
> We have the following and currently used Oracle Text CONTAINS Query
> Operators (reference<
> https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ccref/oracle-text-CONTAINS-query-operators.html#GUID-6410B783-FC9A-4C99-B3AF-9E0349AA43D1>)
> to support our application's text search capabilities and wondering if SOLR
> supports them as well. Appreciate any information that you could share to
> support our exploration.
>
>
> =====================================================================================
> MINUS (-)
> Use the MINUS operator to lower the score of documents that contain
> unwanted noise terms. MINUS is useful when you want to search for documents
> that contain one query term but want the presence of a second term to cause
> a document to be ranked lower.
> Syntax
> Syntax
> Description
> term1-term2
> term1 minus term2
> Returns documents that contain term1. Calculates score by subtracting the
> score of term2 from the score of term1. Only documents with positive score
> are returned.
> Example for MINUS Operator
> Suppose a query on the term cars always returned high scoring documents
> about Ford cars. You can lower the scoring of the Ford documents by using
> the expression:
> Copy
> 'cars - Ford'
> In essence, this expression returns documents that contain the term cars
> and possibly Ford. However, the score for a returned document is the score
> of cars minus the score of Ford.
>
> =====================================================================================
> NEAR (;)
>
> Use the NEAR operator to return a score based on the proximity of two or
> more query terms. Oracle Text returns higher scores for terms closer
> together and lower scores for terms farther apart in a document. If a word
> or term appears more than once in a NEAR query, then the word must appear
> more than once in the document in order to match.
>
> Note:
>
> The NEAR operator works with only word queries. You cannot use NEAR in
> ABOUT queries.
>
> Syntax
>
> Copy
>
> NEAR((word1,word2,...,wordn) [, max_span [, order [, maxreqd]]])
>
> =====================================================================================
> ABOUT
>
> General Behavior
>
> Use the ABOUT operator to return documents that are related to a query
> term or phrase. In English and French, ABOUT enables you to query on
> concepts, even if a concept is not actually part of a query. For example,
> an ABOUT query on heat might return documents related to temperature, even
> though the term temperature is not part of the query.
>
> =====================================================================================
> Narrower Term (NT, NTG, NTP, NTI)
>
> Use the narrower term operators (NT, NTG, NTP, NTI) to expand a query to
> include all the terms that have been defined in a thesaurus as the narrower
> or lower level terms for a specified term. They can also expand the query
> to include all of the narrower terms for each narrower term, and so on down
> through the thesaurus hierarchy.
>
> =====================================================================================
> Translation Term (TR)
> Use the translation term operator (TR) to expand a query to include all
> defined foreign language equivalent terms.
> Syntax
> Syntax
> Description
> TR(term[, lang, [thes]])
> Expands term to include all the foreign equivalents that are defined for
> term.
>
> =====================================================================================
> Translation Term Synonym (TRSYN)
> Use the translation term synonym operator (TRSYN) to expand a query to
> include all the defined foreign equivalents of the query term, the synonyms
> of query term, and the foreign equivalents of the synonyms.
> Syntax
> Syntax
> Description
> TRSYN(term[, lang, [thes]])
> Expands term to include foreign equivalents of term, the synonyms of term,
> and the foreign equivalents of the synonyms.
>
> =====================================================================================
> Broader Term (BT, BTG, BTP, BTI)
>
> Use the broader term operators (BT, BTG, BTP, BTI) to expand a query to
> include the term that has been defined in a thesaurus as the broader or
> higher level term for a specified term. They can also expand the query to
> include the broader term for the broader term and the broader term for that
> broader term, and so on up through the thesaurus hierarchy.
>
> =====================================================================================
> Preferred Term (PT)
> Use the preferred term operator (PT) to replace a term in a query with the
> preferred term that has been defined in a thesaurus for the term.
> Syntax
> Syntax
> Description
> PT(term[,thes])
> Replaces the specified word in a query with the preferred term for term.
>
> =====================================================================================
> Related Term (RT)
> Use the related term operator (RT) to expand a query to include all
> related terms that have been defined in a thesaurus for the term.
> Syntax
> Syntax
> Description
> RT(term[,thes])
> Expands a query to include all the terms defined in the thesaurus as a
> related term for term.
>
> =====================================================================================
> WITHIN
> Use the WITHIN operator to narrow a query down into document sections.
> Document sections can be one of the following:
>
>   *   Zone sections
>   *   Field sections
>   *   Attribute sections
>   *   Special sections (sentence or paragraph)
> Syntax
> Syntax
> Description
> expression WITHIN section
> Searches for expression within the predefined zone, field, or attribute
> section.
> If section is a zone, expression can contain one or more WITHIN operators
> (nested WITHIN) whose section is a zone or special section.
> If section is a field or attribute section, expression cannot contain
> another WITHIN operator.
> expression WITHIN SENTENCE
> Searches for documents that contain expression within a sentence. Specify
> an AND or NOT query for expression.
> The expression can contain one or more WITHIN operators (nested WITHIN)
> whose section is a zone or special section.
> expression WITHIN PARAGRAPH
> Searches for documents that contain expression within a paragraph. Specify
> an AND or NOT query for expression.
> The expression can contain one or more WITHIN operators (nested WITHIN)
> whose section is a zone or special section.
>
> =====================================================================================
>
>
>
> Regards,
> Rhoden
>
> ________________________________
>
> This electronic message contains information from CACI International Inc
> or subsidiary companies, which may be company sensitive, proprietary,
> privileged or otherwise protected from disclosure. The information is
> intended to be used solely by the recipient(s) named above. If you are not
> an intended recipient, be aware that any review, disclosure, copying,
> distribution or use of this transmission or its contents is prohibited. If
> you have received this transmission in error, please notify the sender
> immediately.
>


-- 
Sincerely yours
Mikhail Khludnev

Re: Exploring SOLR (Some Questions on Text Search Features)

Posted by Charlie Hull <ch...@opensourceconnections.com>.
Solr doesn't support Oracle operators, but there are certainly some 
similar operators used by Solr's various Query Parsers: 
https://solr.apache.org/guide/8_7/the-standard-query-parser.html is a 
good starting point. It's also possible to write a Solr query parser to 
support Oracle syntax - I'm not aware of one but at OSC we've done this 
a few times - here's an old colleague with a talk on this from our 
Haystack conference series https://haystackconf.com/2019/custom-solr/

Best

Charlie

On 09/08/2023 11:50, Manahan, Rhoden Mark B. - US wrote:
> Hi,
>
> We are currently trying to explore Apache SOLR and trying to get the feel of its fulltext-search capabilities.
>
> We have the following and currently used Oracle Text CONTAINS Query Operators (reference<https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ccref/oracle-text-CONTAINS-query-operators.html#GUID-6410B783-FC9A-4C99-B3AF-9E0349AA43D1>) to support our application's text search capabilities and wondering if SOLR supports them as well. Appreciate any information that you could share to support our exploration.
>
> =====================================================================================
> MINUS (-)
> Use the MINUS operator to lower the score of documents that contain unwanted noise terms. MINUS is useful when you want to search for documents that contain one query term but want the presence of a second term to cause a document to be ranked lower.
> Syntax
> Syntax
> Description
> term1-term2
> term1 minus term2
> Returns documents that contain term1. Calculates score by subtracting the score of term2 from the score of term1. Only documents with positive score are returned.
> Example for MINUS Operator
> Suppose a query on the term cars always returned high scoring documents about Ford cars. You can lower the scoring of the Ford documents by using the expression:
> Copy
> 'cars - Ford'
> In essence, this expression returns documents that contain the term cars and possibly Ford. However, the score for a returned document is the score of cars minus the score of Ford.
> =====================================================================================
> NEAR (;)
>
> Use the NEAR operator to return a score based on the proximity of two or more query terms. Oracle Text returns higher scores for terms closer together and lower scores for terms farther apart in a document. If a word or term appears more than once in a NEAR query, then the word must appear more than once in the document in order to match.
>
> Note:
>
> The NEAR operator works with only word queries. You cannot use NEAR in ABOUT queries.
>
> Syntax
>
> Copy
>
> NEAR((word1,word2,...,wordn) [, max_span [, order [, maxreqd]]])
> =====================================================================================
> ABOUT
>
> General Behavior
>
> Use the ABOUT operator to return documents that are related to a query term or phrase. In English and French, ABOUT enables you to query on concepts, even if a concept is not actually part of a query. For example, an ABOUT query on heat might return documents related to temperature, even though the term temperature is not part of the query.
> =====================================================================================
> Narrower Term (NT, NTG, NTP, NTI)
>
> Use the narrower term operators (NT, NTG, NTP, NTI) to expand a query to include all the terms that have been defined in a thesaurus as the narrower or lower level terms for a specified term. They can also expand the query to include all of the narrower terms for each narrower term, and so on down through the thesaurus hierarchy.
> =====================================================================================
> Translation Term (TR)
> Use the translation term operator (TR) to expand a query to include all defined foreign language equivalent terms.
> Syntax
> Syntax
> Description
> TR(term[, lang, [thes]])
> Expands term to include all the foreign equivalents that are defined for term.
> =====================================================================================
> Translation Term Synonym (TRSYN)
> Use the translation term synonym operator (TRSYN) to expand a query to include all the defined foreign equivalents of the query term, the synonyms of query term, and the foreign equivalents of the synonyms.
> Syntax
> Syntax
> Description
> TRSYN(term[, lang, [thes]])
> Expands term to include foreign equivalents of term, the synonyms of term, and the foreign equivalents of the synonyms.
> =====================================================================================
> Broader Term (BT, BTG, BTP, BTI)
>
> Use the broader term operators (BT, BTG, BTP, BTI) to expand a query to include the term that has been defined in a thesaurus as the broader or higher level term for a specified term. They can also expand the query to include the broader term for the broader term and the broader term for that broader term, and so on up through the thesaurus hierarchy.
> =====================================================================================
> Preferred Term (PT)
> Use the preferred term operator (PT) to replace a term in a query with the preferred term that has been defined in a thesaurus for the term.
> Syntax
> Syntax
> Description
> PT(term[,thes])
> Replaces the specified word in a query with the preferred term for term.
> =====================================================================================
> Related Term (RT)
> Use the related term operator (RT) to expand a query to include all related terms that have been defined in a thesaurus for the term.
> Syntax
> Syntax
> Description
> RT(term[,thes])
> Expands a query to include all the terms defined in the thesaurus as a related term for term.
> =====================================================================================
> WITHIN
> Use the WITHIN operator to narrow a query down into document sections. Document sections can be one of the following:
>
>    *   Zone sections
>    *   Field sections
>    *   Attribute sections
>    *   Special sections (sentence or paragraph)
> Syntax
> Syntax
> Description
> expression WITHIN section
> Searches for expression within the predefined zone, field, or attribute section.
> If section is a zone, expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
> If section is a field or attribute section, expression cannot contain another WITHIN operator.
> expression WITHIN SENTENCE
> Searches for documents that contain expression within a sentence. Specify an AND or NOT query for expression.
> The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
> expression WITHIN PARAGRAPH
> Searches for documents that contain expression within a paragraph. Specify an AND or NOT query for expression.
> The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
> =====================================================================================
>
>
>
> Regards,
> Rhoden
>
> ________________________________
>
> This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.
>
-- 
Charlie Hull - Managing Consultant at OpenSource Connections Limited
Founding member of The Search Network and co-author of Searching the Enterprise
tel/fax: +44 (0)8700 118334
mobile: +44 (0)7767 825828

OpenSource Connections Europe GmbH | Pappelallee 78/79 | 10437 Berlin
Amtsgericht Charlottenburg | HRB 230712 B
Geschäftsführer: John M. Woodell | David E. Pugh
Finanzamt: Berlin Finanzamt für Körperschaften II


Exploring SOLR (Some Questions on Text Search Features)

Posted by "Manahan, Rhoden Mark B. - US" <rh...@caci.com.INVALID>.
Hi,

We are currently trying to explore Apache SOLR and trying to get the feel of its fulltext-search capabilities.

We have the following and currently used Oracle Text CONTAINS Query Operators (reference<https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ccref/oracle-text-CONTAINS-query-operators.html#GUID-6410B783-FC9A-4C99-B3AF-9E0349AA43D1>) to support our application's text search capabilities and wondering if SOLR supports them as well. Appreciate any information that you could share to support our exploration.

=====================================================================================
MINUS (-)
Use the MINUS operator to lower the score of documents that contain unwanted noise terms. MINUS is useful when you want to search for documents that contain one query term but want the presence of a second term to cause a document to be ranked lower.
Syntax
Syntax
Description
term1-term2
term1 minus term2
Returns documents that contain term1. Calculates score by subtracting the score of term2 from the score of term1. Only documents with positive score are returned.
Example for MINUS Operator
Suppose a query on the term cars always returned high scoring documents about Ford cars. You can lower the scoring of the Ford documents by using the expression:
Copy
'cars - Ford'
In essence, this expression returns documents that contain the term cars and possibly Ford. However, the score for a returned document is the score of cars minus the score of Ford.
=====================================================================================
NEAR (;)

Use the NEAR operator to return a score based on the proximity of two or more query terms. Oracle Text returns higher scores for terms closer together and lower scores for terms farther apart in a document. If a word or term appears more than once in a NEAR query, then the word must appear more than once in the document in order to match.

Note:

The NEAR operator works with only word queries. You cannot use NEAR in ABOUT queries.

Syntax

Copy

NEAR((word1,word2,...,wordn) [, max_span [, order [, maxreqd]]])
=====================================================================================
ABOUT

General Behavior

Use the ABOUT operator to return documents that are related to a query term or phrase. In English and French, ABOUT enables you to query on concepts, even if a concept is not actually part of a query. For example, an ABOUT query on heat might return documents related to temperature, even though the term temperature is not part of the query.
=====================================================================================
Narrower Term (NT, NTG, NTP, NTI)

Use the narrower term operators (NT, NTG, NTP, NTI) to expand a query to include all the terms that have been defined in a thesaurus as the narrower or lower level terms for a specified term. They can also expand the query to include all of the narrower terms for each narrower term, and so on down through the thesaurus hierarchy.
=====================================================================================
Translation Term (TR)
Use the translation term operator (TR) to expand a query to include all defined foreign language equivalent terms.
Syntax
Syntax
Description
TR(term[, lang, [thes]])
Expands term to include all the foreign equivalents that are defined for term.
=====================================================================================
Translation Term Synonym (TRSYN)
Use the translation term synonym operator (TRSYN) to expand a query to include all the defined foreign equivalents of the query term, the synonyms of query term, and the foreign equivalents of the synonyms.
Syntax
Syntax
Description
TRSYN(term[, lang, [thes]])
Expands term to include foreign equivalents of term, the synonyms of term, and the foreign equivalents of the synonyms.
=====================================================================================
Broader Term (BT, BTG, BTP, BTI)

Use the broader term operators (BT, BTG, BTP, BTI) to expand a query to include the term that has been defined in a thesaurus as the broader or higher level term for a specified term. They can also expand the query to include the broader term for the broader term and the broader term for that broader term, and so on up through the thesaurus hierarchy.
=====================================================================================
Preferred Term (PT)
Use the preferred term operator (PT) to replace a term in a query with the preferred term that has been defined in a thesaurus for the term.
Syntax
Syntax
Description
PT(term[,thes])
Replaces the specified word in a query with the preferred term for term.
=====================================================================================
Related Term (RT)
Use the related term operator (RT) to expand a query to include all related terms that have been defined in a thesaurus for the term.
Syntax
Syntax
Description
RT(term[,thes])
Expands a query to include all the terms defined in the thesaurus as a related term for term.
=====================================================================================
WITHIN
Use the WITHIN operator to narrow a query down into document sections. Document sections can be one of the following:

  *   Zone sections
  *   Field sections
  *   Attribute sections
  *   Special sections (sentence or paragraph)
Syntax
Syntax
Description
expression WITHIN section
Searches for expression within the predefined zone, field, or attribute section.
If section is a zone, expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
If section is a field or attribute section, expression cannot contain another WITHIN operator.
expression WITHIN SENTENCE
Searches for documents that contain expression within a sentence. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
expression WITHIN PARAGRAPH
Searches for documents that contain expression within a paragraph. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
=====================================================================================



Regards,
Rhoden

________________________________

This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.

Exploring SOLR (Some Questions on Text Search Features)

Posted by "Manahan, Rhoden Mark B. - US" <rh...@caci.com.INVALID>.
Hi,

We are currently trying to explore Apache SOLR and trying to get the feel of its fulltext-search capabilities.

We have the following and currently used Oracle Text CONTAINS Query Operators (reference<https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ccref/oracle-text-CONTAINS-query-operators.html#GUID-6410B783-FC9A-4C99-B3AF-9E0349AA43D1>) to support our application's text search capabilities and wondering if SOLR supports them as well. Appreciate any information that you could share to support our exploration.

=====================================================================================
MINUS (-)
Use the MINUS operator to lower the score of documents that contain unwanted noise terms. MINUS is useful when you want to search for documents that contain one query term but want the presence of a second term to cause a document to be ranked lower.
Syntax
Syntax
Description
term1-term2
term1 minus term2
Returns documents that contain term1. Calculates score by subtracting the score of term2 from the score of term1. Only documents with positive score are returned.
Example for MINUS Operator
Suppose a query on the term cars always returned high scoring documents about Ford cars. You can lower the scoring of the Ford documents by using the expression:
Copy
'cars - Ford'
In essence, this expression returns documents that contain the term cars and possibly Ford. However, the score for a returned document is the score of cars minus the score of Ford.
=====================================================================================
NEAR (;)

Use the NEAR operator to return a score based on the proximity of two or more query terms. Oracle Text returns higher scores for terms closer together and lower scores for terms farther apart in a document. If a word or term appears more than once in a NEAR query, then the word must appear more than once in the document in order to match.

Note:

The NEAR operator works with only word queries. You cannot use NEAR in ABOUT queries.

Syntax

Copy

NEAR((word1,word2,...,wordn) [, max_span [, order [, maxreqd]]])
=====================================================================================
ABOUT

General Behavior

Use the ABOUT operator to return documents that are related to a query term or phrase. In English and French, ABOUT enables you to query on concepts, even if a concept is not actually part of a query. For example, an ABOUT query on heat might return documents related to temperature, even though the term temperature is not part of the query.
=====================================================================================
Narrower Term (NT, NTG, NTP, NTI)

Use the narrower term operators (NT, NTG, NTP, NTI) to expand a query to include all the terms that have been defined in a thesaurus as the narrower or lower level terms for a specified term. They can also expand the query to include all of the narrower terms for each narrower term, and so on down through the thesaurus hierarchy.
=====================================================================================
Translation Term (TR)
Use the translation term operator (TR) to expand a query to include all defined foreign language equivalent terms.
Syntax
Syntax
Description
TR(term[, lang, [thes]])
Expands term to include all the foreign equivalents that are defined for term.
=====================================================================================
Translation Term Synonym (TRSYN)
Use the translation term synonym operator (TRSYN) to expand a query to include all the defined foreign equivalents of the query term, the synonyms of query term, and the foreign equivalents of the synonyms.
Syntax
Syntax
Description
TRSYN(term[, lang, [thes]])
Expands term to include foreign equivalents of term, the synonyms of term, and the foreign equivalents of the synonyms.
=====================================================================================
Broader Term (BT, BTG, BTP, BTI)

Use the broader term operators (BT, BTG, BTP, BTI) to expand a query to include the term that has been defined in a thesaurus as the broader or higher level term for a specified term. They can also expand the query to include the broader term for the broader term and the broader term for that broader term, and so on up through the thesaurus hierarchy.
=====================================================================================
Preferred Term (PT)
Use the preferred term operator (PT) to replace a term in a query with the preferred term that has been defined in a thesaurus for the term.
Syntax
Syntax
Description
PT(term[,thes])
Replaces the specified word in a query with the preferred term for term.
=====================================================================================
Related Term (RT)
Use the related term operator (RT) to expand a query to include all related terms that have been defined in a thesaurus for the term.
Syntax
Syntax
Description
RT(term[,thes])
Expands a query to include all the terms defined in the thesaurus as a related term for term.
=====================================================================================
WITHIN
Use the WITHIN operator to narrow a query down into document sections. Document sections can be one of the following:

  *   Zone sections
  *   Field sections
  *   Attribute sections
  *   Special sections (sentence or paragraph)
Syntax
Syntax
Description
expression WITHIN section
Searches for expression within the predefined zone, field, or attribute section.
If section is a zone, expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
If section is a field or attribute section, expression cannot contain another WITHIN operator.
expression WITHIN SENTENCE
Searches for documents that contain expression within a sentence. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
expression WITHIN PARAGRAPH
Searches for documents that contain expression within a paragraph. Specify an AND or NOT query for expression.
The expression can contain one or more WITHIN operators (nested WITHIN) whose section is a zone or special section.
=====================================================================================



Regards,
Rhoden

________________________________

This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.

Re: FOLLOW-UP: Exploring SOLR (Some Questions on Text Search Features)

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello, Rhoden.
TLDR - No.
Longer version.
minus and must_not - goes for free, check the guide. However, in solr they
are too restrictive, they literally subtract unwanted term from result.
If you wish to bury some term it should go like
(+foo +bar)^10 OR (+foo -bar)
or just
+foo^100 bar^0.001

https://solr.apache.org/guide/6_6/the-standard-query-parser.html#TheStandardQueryParser-ProximitySearches
goes as is, but again you need to combine it for bury behavior.

Regarding taxonomies it's a subject for custom query parser development.

Within requires special demarcation - there are no sentence nor paragraph
abstraction out-of the box. Then, from my experience it may be handled via
*custom* Lucene Interval. Note, that lucene's intervals are not avalable in
Solr beside of https://github.com/mkhludnev/solr-flexible-qparser
prototype.

Good Luck!


On Mon, Aug 7, 2023 at 5:02 PM Manahan, Rhoden Mark B. - US
<rh...@caci.com.invalid> wrote:

> Hi,
>
> We have not gotten any response yet from our email below.
>
> Appreciate if you could look into this and provide some information to
> support our exploration of its Full-Text Search capabilities.
>
> Thanks,
>
> Rhoden Manahan
> 202.725.5518
>
> From: Manahan, Rhoden Mark B. - US
> Sent: Tuesday, July 25, 2023 3:51 PM
> To: users@solr.apache.org
> Subject: Some Questions on SOLR's Text Search Features
>
> Hi,
>
> We are currently trying to explore Apache SOLR and trying to get the feel
> of its fulltext-search capabilities.
>
> We have the following and currently used Oracle Text CONTAINS Query
> Operators (reference<
> https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ccref/oracle-text-CONTAINS-query-operators.html#GUID-6410B783-FC9A-4C99-B3AF-9E0349AA43D1>)
> to support our application's text search capabilities and wondering if SOLR
> supports them as well. Appreciate any information that you could share to
> support our exploration.
>
>
> =====================================================================================
> MINUS (-)
> Use the MINUS operator to lower the score of documents that contain
> unwanted noise terms. MINUS is useful when you want to search for documents
> that contain one query term but want the presence of a second term to cause
> a document to be ranked lower.
> Syntax
> Syntax
> Description
> term1-term2
> term1 minus term2
> Returns documents that contain term1. Calculates score by subtracting the
> score of term2 from the score of term1. Only documents with positive score
> are returned.
> Example for MINUS Operator
> Suppose a query on the term cars always returned high scoring documents
> about Ford cars. You can lower the scoring of the Ford documents by using
> the expression:
> Copy
> 'cars - Ford'
> In essence, this expression returns documents that contain the term cars
> and possibly Ford. However, the score for a returned document is the score
> of cars minus the score of Ford.
>
> =====================================================================================
> NEAR (;)
>
> Use the NEAR operator to return a score based on the proximity of two or
> more query terms. Oracle Text returns higher scores for terms closer
> together and lower scores for terms farther apart in a document. If a word
> or term appears more than once in a NEAR query, then the word must appear
> more than once in the document in order to match.
>
> Note:
>
> The NEAR operator works with only word queries. You cannot use NEAR in
> ABOUT queries.
>
> Syntax
>
> Copy
>
> NEAR((word1,word2,...,wordn) [, max_span [, order [, maxreqd]]])
>
> =====================================================================================
> ABOUT
>
> General Behavior
>
> Use the ABOUT operator to return documents that are related to a query
> term or phrase. In English and French, ABOUT enables you to query on
> concepts, even if a concept is not actually part of a query. For example,
> an ABOUT query on heat might return documents related to temperature, even
> though the term temperature is not part of the query.
>
> =====================================================================================
> Narrower Term (NT, NTG, NTP, NTI)
>
> Use the narrower term operators (NT, NTG, NTP, NTI) to expand a query to
> include all the terms that have been defined in a thesaurus as the narrower
> or lower level terms for a specified term. They can also expand the query
> to include all of the narrower terms for each narrower term, and so on down
> through the thesaurus hierarchy.
>
> =====================================================================================
> Translation Term (TR)
> Use the translation term operator (TR) to expand a query to include all
> defined foreign language equivalent terms.
> Syntax
> Syntax
> Description
> TR(term[, lang, [thes]])
> Expands term to include all the foreign equivalents that are defined for
> term.
>
> =====================================================================================
> Translation Term Synonym (TRSYN)
> Use the translation term synonym operator (TRSYN) to expand a query to
> include all the defined foreign equivalents of the query term, the synonyms
> of query term, and the foreign equivalents of the synonyms.
> Syntax
> Syntax
> Description
> TRSYN(term[, lang, [thes]])
> Expands term to include foreign equivalents of term, the synonyms of term,
> and the foreign equivalents of the synonyms.
>
> =====================================================================================
> Broader Term (BT, BTG, BTP, BTI)
>
> Use the broader term operators (BT, BTG, BTP, BTI) to expand a query to
> include the term that has been defined in a thesaurus as the broader or
> higher level term for a specified term. They can also expand the query to
> include the broader term for the broader term and the broader term for that
> broader term, and so on up through the thesaurus hierarchy.
>
> =====================================================================================
> Preferred Term (PT)
> Use the preferred term operator (PT) to replace a term in a query with the
> preferred term that has been defined in a thesaurus for the term.
> Syntax
> Syntax
> Description
> PT(term[,thes])
> Replaces the specified word in a query with the preferred term for term.
>
> =====================================================================================
> Related Term (RT)
> Use the related term operator (RT) to expand a query to include all
> related terms that have been defined in a thesaurus for the term.
> Syntax
> Syntax
> Description
> RT(term[,thes])
> Expands a query to include all the terms defined in the thesaurus as a
> related term for term.
>
> =====================================================================================
> WITHIN
> Use the WITHIN operator to narrow a query down into document sections.
> Document sections can be one of the following:
>
>   *   Zone sections
>   *   Field sections
>   *   Attribute sections
>   *   Special sections (sentence or paragraph)
> Syntax
> Syntax
> Description
> expression WITHIN section
> Searches for expression within the predefined zone, field, or attribute
> section.
> If section is a zone, expression can contain one or more WITHIN operators
> (nested WITHIN) whose section is a zone or special section.
> If section is a field or attribute section, expression cannot contain
> another WITHIN operator.
> expression WITHIN SENTENCE
> Searches for documents that contain expression within a sentence. Specify
> an AND or NOT query for expression.
> The expression can contain one or more WITHIN operators (nested WITHIN)
> whose section is a zone or special section.
> expression WITHIN PARAGRAPH
> Searches for documents that contain expression within a paragraph. Specify
> an AND or NOT query for expression.
> The expression can contain one or more WITHIN operators (nested WITHIN)
> whose section is a zone or special section.
>
> =====================================================================================
>
>
>
> Regards,
> Rhoden
>
> ________________________________
>
> This electronic message contains information from CACI International Inc
> or subsidiary companies, which may be company sensitive, proprietary,
> privileged or otherwise protected from disclosure. The information is
> intended to be used solely by the recipient(s) named above. If you are not
> an intended recipient, be aware that any review, disclosure, copying,
> distribution or use of this transmission or its contents is prohibited. If
> you have received this transmission in error, please notify the sender
> immediately.
>


-- 
Sincerely yours
Mikhail Khludnev