link, title, and text
have different weights when the terms are found inside them.
Hi @mschoch,
I'm trying to use Bleve on a new project to index IP-related info. My data represents IP-range and contains two fields: StartIP
and EndIP
. The main purpose is to find that range having the exact IP-address.
For example, StartIP: 192.168.0.0, EndIP: 192.168.255.255
, and the desired IP-address is 192.168.100.100
.
Because I have IPv4 and IPv6, I must use big.Int
type to represent IP-addresses. So, I convert my data to big.Int
and save it to bleve as a numeric field.
I build search-query this way:
func buildSearchQuery(ipAddr string) query.Query {
ipNumeric := ipToInt(ipAddr)
q1 := bleve.NewQueryStringQuery(fmt.Sprintf("%s:<=%d", InfoStartIP, ipNumeric))
q2 := bleve.NewQueryStringQuery(fmt.Sprintf("%s:>=%d", InfoEndIP, ipNumeric))
return bleve.NewConjunctionQuery(q1, q2)
}
In the end, bleve cannot find any data on my requests. I think, it's because bleve use float64 for numeric fields.
Maybe you have an advance for me on how to store and search for IP-ranges using bleve?