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.
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