How to get all Product with a specific TextOption field or MediaPointerFile field having any values using search Query(using lucene)?
I need to list down all product with document and TextOption values as table.
Some thing like this, Product Name | File _____ | TextOption value1 | TextOption value2
Product1 _____ | filename__ | Yes ____________ | No
product2 _____ | filename __ | No ____________ | Yes
Hi @Ericsj11
I Don’t want to search for a specific value, I just want to get all product that have any value specified in TextOption field or MediaPointerFile field of base product .
Aha, sorry don’t know about that. It’s possible with dataservice, but that calls the database so it’s not good to use for customers.
You could add a true/false value in the index with the IIndexingProviderPreProcessor by checking those values in PreProcessDocument. And then search the true/false value.
It might not be the best solution if “any” searches exists, but it’s a valid solution
It’s not possible to search for any value, and Lucene doesn’t index null values. So you would have to do something like Eric suggests: use a dummy value that you index if no value is set and then you can do a search excluding all results with the dummy value.
The other option is DataService which supports many different operators, but you need to build a cache if the query is accessible from the public site to avoid performance issues.