Skip to Content
author's profile photo Former Member
Former Member

Custom property search

Hello all,

i found the following in a doc here on SDN.

<quote>

Building queries for certain custom properties is also possible with this factory class. This sample builds a query for the modelled custom property “fruits” in the namespace “custom” (see PropertyMetadataService) linked by a logical OR operation:

SearchQueryListBuilder sqb = new SearchQueryListBuilder();

sqb.setSelectedCustomProps(

"custom:fruits(value=banana),custom:fruits(value=pine)"

);

IQueryEntryList qel = sqb.buildSearchQueryList();

</quote>

I've used this code on a custom search component to search for resources with a given custom param and it works as described. Although I'm using a SearchQueryBuilder object, not a SearchQueryListBuilder object as used above.

Does anyone know what I need to do to change the search from a logical OR to a logical AND? Can I mix these, like (x AND y) OR z?

Thanks in advance,

Patrick.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Feb 28, 2005 at 03:29 PM

    Hi Patrick,

    > Although I'm using a SearchQueryBuilder object

    And this has a <i>buildSearchQueryList()</i> method?! (Mine does not.)

    Anyhow, what you are doing at the base is building an IQueryEntryList, consisting of IQueryEntries. To have to queries (for example a textual search term and a property query) bound together just set an operator query in the middle (this will be done automatically by the method you described, I expect).

    So create an IQueryEntry, set it's RowType to OPERATOR, set it's value to "AND" or "OR" or "NOT" and add this queryEntry to the queryEntryList in question.

    For a queryEntryList produced automatically, check the single queries (and modificate them, if wanted).

    Hope it helps

    Detlev

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.