Is there a way to query Sphinx for records that have a particular field that is not empty? -


i'm using sph_match_extended2 match mode sphinx 0.9.9 , want write search query finds records have in particular field. have tried following no success:

@myfield * @myfield !"" 

i figure can add field index checks , query against that, i'd prefer have more flexibility that--it nice able through query syntax.

any thoughts?

you can without updating/changing db -- modifying sql_query index/source built off of. e.g.

 sql_query = select id, \                if(title!='',title,'this_field_is_actually_blank') \              table  

then running off of previous poster's comment, use negation in sphinx query.

alternatively, create dynamic sphinx attribute filter against. e.g.

 sql_query = select id, \                title,  \                if(title!='',1,0) title_is_not_blank \              table    sql_attr_uint = title_is_not_blank 

then make sure filter on title_is_not_blank=1 every search.

or, depending on application, if never need ones blank content, eliminate sql_query where clause. e.g.

 sql_query = select id, \                title  \              table               title!='' 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -