Home » Server Options » Text & interMedia » Ending printjoin character issue and CONTAINS function not working (merged 2 threads)
Ending printjoin character issue and CONTAINS function not working (merged 2 threads) [message #272379] Thu, 04 October 2007 15:53 Go to next message
yumyumyeh
Messages: 8
Registered: October 2007
Junior Member
? character has been designated as a printjoin character through preferences.
I am trying to search a record containing the following literal word: this?
eg: How About This?
I am issuing my query like this:
select * from table where contains(column, ' this\? ') > 0

This does return my wanted records which contains this?
but it also returns all records simply containing 'this'. (No ? after 'this'). So basically it is ignoring the ? character
even though i have escaped it using \.

Is this a known issue or a bug? Is there a solution.
Any help is greatly appreciated.

[Updated on: Fri, 05 October 2007 10:46]

Report message to a moderator

CONTAINS function not working! [message #272398 is a reply to message #272379] Thu, 04 October 2007 21:11 Go to previous messageGo to next message
yumyumyeh
Messages: 8
Registered: October 2007
Junior Member
Is there a way to retrieve only 'on demand?', assuming ? is a printjoin character?

The query
SELECT * FROM table WHERE CONTAINS (search_text, '{on demand?}', 1) > 0
returns both
on demand
and
on demand?

I want only on demand? to be returned. In other words I want
an 'exect' match. Is it possible or is there a workaround?
Re: Ending printjoin character issue [message #279541 is a reply to message #272379] Thu, 08 November 2007 23:20 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
A printjoin joins two things together on either side of it. What you are looking for is an endjoin. Also, "this" is a default stopword, so you need to make sure you are using an empty stoplist or a stoplist that does not include "this" as a stopword. You can check the token_text column for your index to see how things are tokenized. Please see the demonstration below.

SCOTT@orcl_11g> CREATE TABLE your_table (your_column  VARCHAR2 (60))
  2  /

Table created.

SCOTT@orcl_11g> INSERT INTO your_table VALUES ('How About This?')
  2  /

1 row created.

SCOTT@orcl_11g> INSERT INTO your_table VALUES ('What About This')
  2  /

1 row created.

SCOTT@orcl_11g> EXEC CTX_DDL.CREATE_PREFERENCE ('your_pref', 'BASIC_LEXER')

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> EXEC CTX_DDL.SET_ATTRIBUTE ('your_pref', 'ENDJOINS', '?')

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> CREATE INDEX your_index ON your_table (your_column)
  2  INDEXTYPE IS CTXSYS.CONTEXT
  3  PARAMETERS
  4    ('LEXER	  your_pref
  5  	 STOPLIST CTXSYS.EMPTY_STOPLIST')
  6  /

Index created.

SCOTT@orcl_11g> SELECT token_text FROM dr$your_index$i
  2  /

TOKEN_TEXT
----------------------------------------------------------------
ABOUT
HOW
THIS
THIS?
WHAT

SCOTT@orcl_11g> select * from your_table where contains(your_column, 'this\?') > 0
  2  /

YOUR_COLUMN
------------------------------------------------------------
How About This?

SCOTT@orcl_11g> select * from your_table where contains(your_column, '{this?}') > 0
  2  /

YOUR_COLUMN
------------------------------------------------------------
How About This?

SCOTT@orcl_11g> 


Re: CONTAINS function not working! [message #279544 is a reply to message #272398] Thu, 08 November 2007 23:28 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
SCOTT@orcl_11g> CREATE TABLE your_table (your_column  VARCHAR2 (60))
  2  /

Table created.

SCOTT@orcl_11g> INSERT INTO your_table VALUES ('on demand?')
  2  /

1 row created.

SCOTT@orcl_11g> INSERT INTO your_table VALUES ('on demand')
  2  /

1 row created.

SCOTT@orcl_11g> EXEC CTX_DDL.CREATE_PREFERENCE ('your_pref', 'BASIC_LEXER')

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> EXEC CTX_DDL.SET_ATTRIBUTE ('your_pref', 'ENDJOINS', '?')

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> CREATE INDEX your_index ON your_table (your_column)
  2  INDEXTYPE IS CTXSYS.CONTEXT
  3  PARAMETERS
  4    ('LEXER	  your_pref
  5  	 STOPLIST CTXSYS.EMPTY_STOPLIST')
  6  /

Index created.

SCOTT@orcl_11g> SELECT token_text FROM dr$your_index$i
  2  /

TOKEN_TEXT
----------------------------------------------------------------
DEMAND
DEMAND?
ON

SCOTT@orcl_11g> select * from your_table where contains(your_column, '{on demand?}') > 0
  2  /

YOUR_COLUMN
------------------------------------------------------------
on demand?

SCOTT@orcl_11g> 

Re: CONTAINS function not working! [message #279637 is a reply to message #279544] Fri, 09 November 2007 08:07 Go to previous message
yumyumyeh
Messages: 8
Registered: October 2007
Junior Member
Barbara,

Thank you so much.
I never came across 'endjoins' before.
So that solves my problem!

Regards,
Mohamed
Previous Topic: Problem with stop words
Next Topic: Fuzzy search
Goto Forum:
  


Current Time: Sun Dec 11 04:11:08 CST 2016

Total time taken to generate the page: 0.15432 seconds