Full text search command parameter from C#

Full text search command parameter from C#

Post by zb » Sun, 11 Dec 2005 18:47:08


I have an application where I am required to run a full text query. My
database is MySQL and code in C#. The way all queries are SELECT * FROM
table WHERE firstname = ? and using command parameter the value of ? is
added. But, how would I do the same in case of full text search.

SELECT *, ROUND( MATCH(title, comments) AGAINST (? IN BOOLEAN MODE ) *
10, 2 ) AS score FROM table WHERE MATCH(title,comments) AGAINST (? IN
BOOLEAN MODE ) ORDER BY score DESC

When I provide the value as titl*, I don't get anything. But, when I
hard code the query like:

SELECT *, ROUND( MATCH(title, comments) AGAINST ('titl*' IN BOOLEAN
MODE ) * 10, 2 ) AS score FROM table WHERE MATCH(title,comments)
AGAINST ('titl*' IN BOOLEAN MODE ) ORDER BY score DESC

I get good result.

This is how I am building parameters:

public static OdbcCommand BuildCommand ( ArrayList QueryParameters,
string Query )
{
OdbcCommand Command = new OdbcCommand();
Command.CommandType = CommandType.Text;
Command.CommandText = Query;

for( int i = 0; i <= QueryParameters.Count - 1; i++ )
{
string[] Parameter = (string[])QueryParameters[ i ];
Command.Parameters.Add( new OdbcParameter( Parameter[ 0 ],
Parameter[ 1 ] ) );
}

return Command;
}

Any help will be appreciated.

Thanks.
 
 
 

1. Carrying out a full-text search, but without the full-text search...

2. Project 2003 and Full-Text Search / Full-Text Index

I have configured Windows Sharepoint Services for full-
text searching by setting the appropriate option in WSS /
Configure Administrative Virtual Server / Configure Full-
Text Search.

The full-text searching does not return any documents. My
SQL DBA informs me that the SQL instance has full-text
indexing enabled by default but that in order to get this
working that certain columns in the tables have to be
indexed.

Can anyone help me get full-text search / full-text index
set up for WSS for Project 2003?

Thank you,

Matt Quinn
Yellow Technologies
MCSE, hp ASE
913-344-3829

3. Full text search not working though Full-Text Catalogs are available

4. Full-Text Search is not installed, or a full-text component ca

5. MSDE2000 Full-Text Indexing & Full-Text Search (FTS)

6. Options for generic full-text search without using database-specific full-text engine?

7. SPS 2003 Full-Text Search and SQL Server 2000 Full-Text Index Cata

8. Full text search not working though Full-Text Catalogs are available

9. Full-Text Search is not installed, or a full-text component cannot

10. Full Text search for 'C#' and 'C++'

11. Full Text Search, passing parameters

12. New Article: Testing a Full-Text Search IFilter in C#

13. Passing Parameters into a Full text search Query

14. Searching text fields without full text search?