[MarkLogic Dev General] lib-search, Fields, andcts:field-word-query

Mike Sokolov sokolov at ifactory.com
Fri Jul 11 12:58:29 PDT 2008


Thank you for clarifying that point - I was coming around to that 
understanding, but this makes it very clear.

I think the approach of adding elements will ultimately get us what we need.

-Mike (S)

Michael Blakeley wrote:
> Fields (in the field-word-query sense) don't relate to the indexes 
> used for element-query. As the admin guide puts it, "You can use 
> fields to create portions of the content that you might want to query 
> as a single unit."
>
> That phrase "single unit" is key: fields are flat buckets of words, 
> and do not relate to the original XML structure. If you want to 
> combine several elements in an structurally-indexed manner, add a new 
> XML element that has the desired structure (Corb and RecordLoader each 
> have features aimed at this area).
>
> -- Mike
>
> Mike Sokolov wrote:
>> Thanks to all of you for the info on how to get the field-word-query 
>> behavior (three different ways, I think!).
>> I personally think an explicit "code" value is better (#default?) if 
>> you are planning to add support to lp:search-field-map.
>>
>> Could any of you take this opportunity to comment on the behavior of 
>> cts:field-word-query() within cts:element-query?  Does this do 
>> anything useful?  My initial experiments seem to indicate they don't 
>> mix well, but I feel I must be missing something.
>>
>> -Mike
>>
>>
>> Frank Sanders wrote:
>>> John,
>>>
>>>     One way I've handled this before when I knew all of my "full text"
>>> searches should only be searching within the field's contents is to 
>>> modify
>>> the custom:word-query function within lib-parser-custom.xqy to use a
>>> field-word-query instead of a word query.     You'll still be able 
>>> to use the element mappings and such as
>>> configured in lib-search so if the user issues query was "foo:bar" 
>>> to search
>>> for documents with the appropriately configured/mapped foo element 
>>> for the
>>> value of bar will continue to behave as before. It's just that any 
>>> query
>>> that would have been a word-query will now be a field-word-query. 
>>>     There may be better, more robust methods to tackle this. But it's a
>>> solution I've used in the past. Hope this helps!
>>>
>>> -fs
>>>
>>> -----Original Message-----
>>> From: general-bounces at developer.marklogic.com
>>> [mailto:general-bounces at developer.marklogic.com] On Behalf Of John 
>>> Craft
>>> Sent: Thursday, July 10, 2008 12:34 PM
>>> To: General Mark Logic Developer Discussion
>>> Subject: RE: [MarkLogic Dev General] lib-search,
>>> Fields,andcts:field-word-query
>>>
>>> I believe I'm looking for the same answer as Mike.  Is there a way to
>>> specify a field to search without requiring the user to know the 
>>> name of the
>>> field?  Basically, the default search is a fielded search.
>>>
>>> John Craft
>>>
>>> ________________________________________
>>> From: general-bounces at developer.marklogic.com
>>> [mailto:general-bounces at developer.marklogic.com] On Behalf Of Mike 
>>> Sokolov
>>> Sent: Thursday, July 10, 2008 9:37 AM
>>> To: General Mark Logic Developer Discussion
>>> Subject: Re: [MarkLogic Dev General] lib-search,
>>> Fields,andcts:field-word-query
>>>
>>> Frank did you indicate there was a way to map a search "box" (element,
>>> field, parameter - these words are too overloaded) to a field in the
>>> lib-search criteria, rather than requiring the user to enter a 
>>> formatted
>>> query (or munging the text of their query)?  That would be useful
>>>
>>> -Mike
>>> Frank Rubino wrote: It's the indicator passed in the user's query 
>>> string:
>>>
>>> myField:smith
>>>
>>> It allows you to provide the user with a more friendly syntax.
>>>
>>> On 7/10/08 9:59 AM, "John Craft" <jcraft at jonesmcclure.com> wrote:
>>>
>>>   Frank-
>>>
>>> In your example below, what does the code attribute map to?
>>>
>>> John Craft
>>>
>>> -----Original Message-----
>>> From: general-bounces at developer.marklogic.com
>>> [mailto:general-bounces at developer.marklogic.com] On Behalf Of Frank
>>> Rubino
>>> Sent: Thursday, July 10, 2008 8:18 AM
>>> To: General Mark Logic Developer Discussion
>>> Subject: Re: [MarkLogic Dev General] lib-search, Fields,
>>> andcts:field-word-query
>>>
>>> John-
>>> The lib-parser example mapping element is configured to specify
>>> field-word
>>> queries on a field called "weighted".
>>>
>>> To use fields you sprecify, you create your own  mapping element:
>>>
>>> declare namespace lp = "http://www.marklogic.com/ps/lib/lib-parser"
>>> (:don't
>>> forget namespace:)
>>>
>>> <lp:search-field-map>
>>>     <lp:mapping code="myField" field="fieldName"/>
>>>   </lp:search-field-map>
>>>
>>> The field attribute indicates the name of the field you created in the
>>> admin
>>> interface.
>>>
>>> You use this element with lib-search when you create your
>>> search-criteria
>>> element.
>>>
>>> Frank
>>>
>>>
>>>
>>> On 7/9/08 11:49 PM, "John Craft" <jcraft at jonesmcclure.com> wrote:
>>>
>>>     I have created a field with appropriate includes and excludes, 
>>> but I
>>>       am
>>>     having difficulty figuring out how to configure lib-search to 
>>> search
>>>       it.
>>>     lib-search keeps wanting to build cts:word-query() constructors 
>>> rather
>>> than a cts:field-word-query() constructor.  I have looked through the
>>> code and found the $SEARCH-FIELD-MAP in lib-parser.xqy but I'm not
>>>       sure
>>>     exactly how to use it.  The example in the documentation seems to
>>> indicate <lp:mapping /> is for searching specific elements.
>>>
>>> Any insight you could share with lib-search and fields would be
>>> appreciated.
>>>
>>> John Craft
>>> _______________________________________________
>>> General mailing list
>>> General at developer.marklogic.com
>>> http://xqzone.com/mailman/listinfo/general
>>>      
>>> Frank Rubino
>>> Mark Logic Corp.
>>>
>>> 862-596-3248
>>> Frank.Rubino at marklogic.com
>>>    
>>>
>>> Frank Rubino
>>> Mark Logic Corp.
>>>
>>> 862-596-3248
>>> Frank.Rubino at marklogic.com
>>>   _______________________________________________
>>> General mailing list
>>> General at developer.marklogic.com
>>> http://xqzone.com/mailman/listinfo/general
>>>   
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>> _______________________________________________
>>> General mailing list
>>> General at developer.marklogic.com
>>> http://xqzone.com/mailman/listinfo/general
>>>   
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> General mailing list
>> General at developer.marklogic.com
>> http://xqzone.com/mailman/listinfo/general
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general


More information about the General mailing list