Link to home
Start Free TrialLog in
Avatar of scribla
scriblaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Search for a number rather than text?

I have a small database containing fixed assets. Each asset has a number E.G. 123. When the database was written the number was stored in a text field rather than a number field. I recently changed this to a number field as it was number '1000' was showing at the the bottom of the view, with '999' at the top.

So I changed the field in the form to a number field, then edited and saved each doc to update. The problem is I can no longer use the content of this field/view to search for say asset number '503' it just comes back with no results.

I deleted and created a new text index, but no change. Will I have to revert to storing this asset number as text in order for the search to work? If so, how would I create a view that sorts 999 as a lower value than 1000?

Thanks.
Avatar of CRAK
CRAK
Flag of Netherlands image

You could convert the old text values to numbers using an agent:

Field assetnumber := @TextToNumber(@Text(assetnumber));
@Success

note:
I first convert ALL values to text, then to number to avoid errors on your new (number) documents:
@TextToNumber(<number>) will raise an error like "text expected".
Avatar of scribla

ASKER

CRAK, I don't have any old text values, I have taken care of the conversion, the asset numbers in the field in question are stored as numbers.
Sorry, now I see what you mean.
Yes... that's unfortunately how the searchbar works.

You could either reconvert the numbers to text,
Add an additional field (computed) to store the same number as text
Use the options under "more" to look specifically for documents where field (assetnumber) is equal to 503.

I never realized that it didn't find numbers!
Avatar of qwaletee
qwaletee

Did you delete and recreate the ful text index AFTER converting all numbers to text?

Did you make sure all remnants of the ld full text index were removed before recreating the index?

Did you try compacting the database between the destruction and recreation of the full text index?
I tried it all qwaletee.... it doesn't find numbers!
R5 full text index supposedly index text only ! Not sure why they removed support for numbers which was available in R4. Not sure of R6 though ? Kind of limitation. Let me see if I can find any more information.


~Hemanth
Avatar of scribla

ASKER

I'm guessing finding numbers in the FTI is out of the question.
So, if I convert back to text, what's the best practice to store as text, but be able to sort 'as' numbers in my view?

What I mean by that is a number field in a view would sort 1000,999,998,997,etc. but a text field in a view would result in 3,2,1,1000.

ASKER CERTIFIED SOLUTION
Avatar of HemanthaKumar
HemanthaKumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
HemanthaKumar,
> R5 full text index supposedly index text only ! Not sure why they removed
> support for numbers which was available in R4. Not sure of R6 though ? Kind
> of limitation. Let me see if I can find any more information.

What are you talking about?  I just tried it, no problem.  Of course, the client I just tried it with was an early version of 5, and I do know they tweaked the engine a bit during the 5 release cycle (I think 5.0.5).
Just tried it on a 6 server using a 5 client, no prob.
5.0.10 here..... sux!
I am talking about what exactly the problem is...

Crak, same here..
??? Same there, but you don't know what the problem is?
Create a number field. Create a new doc, fill out the number field with a known value, create/update the FT index, search for the number and find out what the question is about and why 5.0.10 sux.
;-))
Have you tried searching by field name for the new field?

And why would anyone use .10 anyway.  .12 has been out for six months already.
Sure I have.... that works ok. But like I said, I never knew RT search didn't pick up numbers if only entered in the searchbar. And honestly, thats the only dissapointment that I can think of.
Use of 5.0.10 is determined by the company. It's probably too much effort to roll out updates. Administratoes have tried updates, especially for admin client (remote console) related bugs. Temporarily up to .13 I believe.
I'd rather see 6.x installed so I'd finally get to play with those features!
Avatar of scribla

ASKER

Running 5.0.10 client and server here, we should roll out R6 early next year.

I have converted my numbers back to text again, search works as expected, but I still have a problem with my view. I tried @TextToNumber(AssetNo) against my view coloumn, but with strange results. My view coloumn is now populated with values like 1E+02, 10E+02. However, it is at least sorting correctly now!
Avatar of scribla

ASKER

Duh! ignore my last comment. All sorted, works a treat.  Thank you all for your input and thought on this.