You can use a copyField to copy the field ‘s value into a type=“string” field 
during indexing. When searching you can use that field for exact match (case 
must match too). Like Mikhail said, string field type only matches exact 
things. 
—
> On Feb 21, 2025, at 19:40, Mikhail Khludnev <m...@apache.org> wrote:
> Hello Henry
> Your example looks like a StrField match. Check the difference between Str
> and Text fields.
> Otherwise, if you need a text field and match it as whole. It can be
> - boundary tokens + phrase query "BEGIN dog cat pig END"
> - custom code intgating lucene CoveringQuery into Solr parser + number of
> token field
> - the item above might be implemented via a tricky Solr syntax
> range(sum(dog^=1 cat^=1 pig^=1,3,3) AND "dog cat pig" // phrase queires
> 
> On Fri, Feb 21, 2025 at 12:51 AM Farmerie, Henry
> <henry.farme...@siemens.com.invalid> wrote:
> 
>> Suppose I want to do a "MATCHES" search on an document attribute
>> (Description, for example) where my search string must match the entire
>> contents of the Description attribute.
>> 
>> So if the Description = dog cat pig, and I specify "MATCHES" as my search
>> operator, then the only valid search string is "dog cat pig".
>> 
>> I have the field defined in my schema like this:
>> 
>> managed-schema.xml:    <dynamicField name="Zs*" type="text_general"
>> indexed="true"  stored="false"  multiValued="true"/>
>> managed-schema.xml:    <copyField source="Zs*" dest="_text_"/>
>> 
>> Currently, if the contents of the Description are "dog pig cat" and I do
>> this search specifying only "dog pig", it still returns a hit:
>> 
>> http://host:8983/solr/solr1/select?q=(ZsDocumentDescription:"dog pig<
>> http://host:8983/solr/solr1/select?q=(ZsDocumentDescription:%22dog%20pig
>>> ")
>> 
>> So it is looking for the search string being contained in the attribute,
>> as opposed to an exact match.
>> 
>> Is there any query syntax that specifies to match the search string
>> against the entire contents of the attribute?
>> 
>> Henry Farmerie
>> 
>> Siemens Product Lifecycle Management Software Inc.
>> Communications and Government Affairs
>> Lifecycle Coll
>> 
>> Shoreview, MN  55126 United States
>> Fax      :+1 (651) 855-6280
>> henry.farme...@siemens.com <mailto:henry.farme...@siemens.com>
> 
> -- 
> Sincerely yours
> Mikhail Khludnev

Reply via email to