aspose file tools*
The moose likes JDBC and the fly likes fulltext - math - query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "fulltext - math - query" Watch "fulltext - math - query" New topic
Author

fulltext - math - query

fabio alonso
Ranch Hand

Joined: May 15, 2010
Posts: 48
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

Joined: Aug 22, 2010
Posts: 3610
    
  60

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: fulltext - math - query