Pradeep,

That makes more sense; if you use a value constraint, the search will do a 
string comparison, so 100 will not match 100.0.  The range constraint gives you 
type-aware comparisons.  So in your case, you'll want to use the range 
constraint.

--Colleen
________________________________________
From: Pradeep Maddireddy [[email protected]]
Sent: Wednesday, April 28, 2010 8:50 AM
To: General Mark Logic Developer Discussion
Cc: Colleen Whitney
Subject: Re: [MarkLogic Dev General] Search API numeric field

Hi Colleen,

  The "Price" was a typo in my email I actually used "price". Actually
the numeric field in my case is of type decimal, it was having a value
of 100.0

The search API worked when I used  price:100.0   but failed when I used
price:100

But if I use a range constraint both work.

Thanks
Pradeep Maddireddy


On 4/28/10, Colleen Whitney <[email protected]> wrote:
> Hi Pradeep,
>
> I think the problem is that on your value constraint, you've got the name
> "Price", not "price".  The case must match.  If you make the name "price"
> and try the value constraint again, I think you'll get the result you're
> looking for.  One thing to note:  the value query will be a string
> comparison (not typed), so in some cases the results will in fact be
> different with a value constraint vs. a range constraint.  In the example
> you've given, either should work.
>
> --Colleen
> ________________________________________
> From: [email protected]
> [[email protected]] On Behalf Of Pradeep Maddireddy
> [[email protected]]
> Sent: Wednesday, April 28, 2010 2:59 AM
> To: General
> Subject: [MarkLogic Dev General] Search API numeric field
>
> Hi..!
>
>   In my XML file I have a numeric field "price". When I create a value
> constraint for this field as
>
> <constraint name="Price">
> <value>
> <element ns="http://marklogic.com/ls"; name="price"/>
> </value>
>  </constraint>
>
> and pass it in the options field to Search API and search term as
> price:120,
> search API doesn't return any result  but when I create a range
> constraint  for the same field as
> <constraint name="price">
> <range type="xs:decimal" facet="false">
> <element ns="http://marklogic.com/ls"; name="price"/>
>  </range>
> </constraint>
>
> and pass the same search term search API returns few results. Is it
> mandatory to have a range constraint for a numeric field instead of
> value constraint.
>
> Thanks
> Pradeep Maddireddy
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to