This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fulltext - math - query

 
fabio alonso
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear,

I'm trying to build the query below for a more detailed search, but giving this error. Under the original code:

[code]
queryPrincipal.append ("FROM manufacturer f, filial_produto fp, f branch, and origin"). append ("WHERE"). append ("= f.filial fp.filial AND"). append ("fp = p.cod_material. cod_material AND "). append (" f.descricao like? ");
[/ code]

I tried to develop this way:

[code]
queryPrincipal.append ("FROM manufacturer f, filial_produto fp, f branch, and origin"). append ("WHERE"). append ("= f.filial fp.filial AND"). append ("fp = p.cod_material. cod_material AND "). append (" MATCH (description) AGAINST ('?' WITH QUERY EXPANSION) ');
[/ code]

But it did not work, you know how I apply this function (Math. and Against) this query?

thanks
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know which database recognizes the MATCH keyword. LIKE on the other hand works in quite some of them.

Your code is definitely missing spaces between keywords in many of the append() calls, and there are other syntax errors in your query (... WHERE = f.filial fp.filial AND ... is one of them).

Print out or log the text of the query you're going to execute and run it using a tool like TOAD or something to get the syntax right first. If any other problems remain, come here again to ask about them, and post relevant code and the exception you get.

Note: why do you partition the text into bits with append's? It seems to be far less readable to me. In this case, when everything is a constant, you can use the plus operator when building the string to break the text of the query into several lines.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic