Search code examples
unionsphinx

Select Union in SphinxQL?


Is it possible to do any sort of Union using SphinxQL? I want to return one set of results containing two queries and in order of the query. A simple example would be:

Select Author from idx_jobs where MATCH('@(Author) Steinbeck') Union Select Author from idx_jobs where MATCH('@(Description) Steinbeck')

Naturally I could do

Select Author from idx_jobs where MATCH('@(Author, Description) Steinbeck')

but I'm trying to provide some control over 'relevance' in the results.


Solution

  • No union.

    But seems like field weight would be useful http://sphinxsearch.com/docs/current.html#sphinxql-select

    .... OPTION field_weights=(author=1000)
    

    Should put the matches against the author field first. (ie add that to end of second query)