0

I have been using regexp_fitler to good effect in my Sphinx configurations, however as far as I know it applies to the entire index in my select.

If my select for idx_example is:

Select Name,Description,City,State from TableA

and I do a regexp_filter e.g.

NY > New York

I can run into issues in for instance the Description field. I realize I can solve this with more complex patterns however given that the State fields I am getting are either Acronyms for Full-Names there is no reason to IF I can somehow force the regexp_filter to act only upon the State field.

user3649739
  • 1,829
  • 2
  • 18
  • 28

1 Answers1

0

There is no offical syntax for it. One of hte main problems is how would sphinx apply it to queries. Would be difficult to apply it consistently.

It could be done with mysql functions, but would get cumbersome, if applying a large list.

 sql_query = Select Name,Description,City,REPLACE('NY','New Your',State) as State \
    FROM TableA

Wonder if could instead implemented it via a join, have a table of 'expansions'

short,full
NY,   New York
CA,   California

Then

sql_query = Select Name,Description,City,coalesce(e.full,State) as State \
   FROM TableA LEFT JOIN expansion e ON (state=short)

(make sure there is an index on expansion.short!)

barryhunter
  • 20,886
  • 3
  • 30
  • 43
  • Thanks, that would circumvent other work I am doing. Plan is to now store the entire html and use either zones or regexp with the tags to be specific about the mapping. Was hoping to avoid that. – user3649739 Jan 31 '17 at 20:39