Slightly off-topic question: what about when you are searching in-memory 
elements? Suppose I contructed 100 xml trees in memory that were each 1K (just 
for example), I put them in a sequence, and then I to use XPath against the 
sequences of trees to find all values of a particular attribute. None of the 
trees are in the db a consequently are not in the index. How does performance 
compare to a situation where these trees were saved as docs in the DB? Is there 
a point where for speed considerations you would want to save the trees to the 
DB just so they could be indexed?

Thanks,
Ryan

> From: kelly.stir...@marklogic.com
> To: general@developer.marklogic.com
> Date: Thu, 5 May 2011 04:41:22 -0700
> Subject: Re: [MarkLogic Dev General] query for search in elements and 
> attributes
> 
> MarkLogic indexes attributes, and you can query on them, but there are a few 
> things to keep in mind:
> 
> 1) attributes are indexed with their parent elements - you can't search 
> across all attributes independent of their parent elements. So, you can't do 
> */@foo and expect it to be resolved out of the indexes. You can still do it, 
> and the results will be accurate, but the performance can be less than ideal. 
> (there may be an exception for xs:id, but I don't recall)
> 
> 2) attribute values are not searched when using cts:word query. Neither are 
> processing instructions or comments, for that matter (but those aren't even 
> indexed). Google doesn't index attributes either. Most of the time attributes 
> contain values that are not to be searched by default. MarkLogic indexes them 
> so they are still searchable.
> 
> 3) You can search on specific attributes with 
> cts:element-attribute-word-query. I believe in the SearchAPI you can use a 
> custom constraint. It is possible to search attributes with the SearchAPI by 
> default, but you would need to explicitly enumerate all the element/attribute 
> pairs you want to search, and that's probably not what you want to do.
> 
> Kelly
> 
> 
> 
> Message: 2
> Date: Thu, 5 May 2011 15:44:45 +0530
> From: Rojan K K <rojankadapur...@gmail.com>
> Subject: [MarkLogic Dev General] query for search in elements and
>       attributes
> To: General@developer.marklogic.com
> Message-ID: <BANLkTi=wj5zmmx4-gsb8acuzxhzvkjv...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi,
> 
> i am doing a search operation in which i will be passing input string to the
> search:parse() API and whose  result is applying for search.
> but i would like make my  search query  to be performed in attributes values 
> also.
>  for eg: when i give '(test) OR (test2) AND (ID123)' as my serach
> query(ID123 is an attribute value)
>  search :parse will be forming query as follows <cts:or-query qtextjoin="OR" 
> strength="10">
> -
> <cts:word-query qtextref="cts:text">
> <cts:text>test</cts:text>
> </cts:word-query>
> -
> <cts:and-query qtextjoin="AND" strength="20">
> -
> <cts:word-query qtextref="cts:text">
> <cts:text>test2</cts:text>
> </cts:word-query>
> -
> <cts:word-query qtextref="cts:text">
> <cts:text>ID123</cts:text>
> </cts:word-query>
> </cts:and-query>
> </cts:or-query>
> 
> and i am giving this for cts:search query,but it is not returning any result 
> for records with the specified attribute.
> 
> Is there any way to search in attributes also using search:parse and 
> cts:search APIs.
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
                                          
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to