Giter Site home page Giter Site logo

nightowl888 / bobobrowse.net Goto Github PK

View Code? Open in Web Editor NEW
40.0 14.0 14.0 4.45 MB

BoboBrowse.Net is a faceted browse engine implemented on a top of Lucene.Net. Originally ported from wonderful Java library developed by John Wang (http://javasoze.github.com/bobo/). While Lucene.Net is good with unstructured data, BoboBrowse.Net fills in the missing piece to handle semi-structured and structured data.

License: Other

PowerShell 2.25% C# 95.73% CSS 0.06% ASP 0.01% JavaScript 1.72% Batchfile 0.13% HTML 0.11%

bobobrowse.net's Introduction

bobobrowse_net MyGet Build Status BoboBrowse.Net NuGet Package

BoboBrowse.Net

Faceted Search for Lucene.Net

Bobo-Browse is a powerful and extensible faceted search engine library built on top of Lucene.Net. It is a C# port of the original Bobo-Browse project written in Java by John Wang.

This project is based on earlier work from here and here, but both of those versions are based on Bobo-Browse.Net 2.x. This is an (almost) complete port of Bobo-Browse 4.0.2, which is fully compatible with Lucene.Net 4.8.0.

Features Not Implemented:

  1. CollectDocIdCache feature of BoboBrowser (uses memory management in a way that is incompatible with .NET).
  2. Util.PrimitiveMatrix, Util.FloatMatrix, and Util.IntMatrix (not used by the rest of the framework and are essentially just 2-dimensional arrays, which don't exist in Java but already exist in .NET).
  3. Util.MemoryManager and Util.MemoryManagerAdminMBean (uses memory management in a way that is incompatible with .NET).
  4. Index.MakeBobo (a console application that can be used for writing Lucene.Net indexes, but isn't required)

Status

Alpha - awaiting port of StandardAnalyzer and QueryParser of Lucene.Net 4.8.0, as well as releases for .NET 3.5 and 4.0.

Documentation

Read the documentation on the wiki: https://github.com/NightOwl888/BoboBrowse.Net/wiki

License

Apache 2.0 License

Install Via NuGet

PM> Install-Package BoboBrowse.Net

See our page on the NuGet gallery.

Building the Source

You only need to build the source if you plan to customize the source, but these instructions are provided in case you need to do so.

Prerequisites:

NOTE: If you have not yet run Windows Powershell on your computer, you will need to run the following command from an elevated command prompt before you can build the source.

Set-ExecutionPolicy RemoteSigned

To build the source, run the following command from the root directory of the Git project (the same directory that contains the .git folder):

build.bat -v:3.2.0 -pv:3.2.0-beta00001

The -v parameter is the file version number, and the -pv parameter is the NuGet package version number. The package version number can contain a pre-release tag as shown in the example, but is not required.

Once the source has been built, you can install Bobo-Browse.Net into your project using NuGet. In Visual Studio, open the Options dialog from the Tools menu. In the left pane, choose NuGet Package Manager > Package Sources. Click the "+" button. Name the package source "Local Bobo-Browse.Net Feed", and add a Windows file path to [Bobo-Browse Project Directory]\packages\packagesource\. You can then use either the UI or Package Manager Console to install Bobo-Browse.Net into your project by selecting the "Local Bobo-Browse.Net Feed" as the package source.

Sample Usage

Here is a quick demonstration showing how easy it is to create a faceted search:

public void TestSimpleBrowser()
{
	var query = new TermQuery(new Term("name", "asp.net"));
	Console.WriteLine(string.Format("query: <{0}>", query.ToString()));
	var request = new BrowseRequest()
	{
		Count = 10,
		Offset = 0,
		Query = query,
		Sort = new Sort(new SortField("price", SortField.DOUBLE, false)).GetSort()
	};

	var facetHandlers = new IFacetHandler[] { new SimpleFacetHandler("category") };
	var browser = new BoboBrowser(BoboIndexReader.GetInstance(IndexReader.Open(_indexDir, true), facetHandlers));
	var facetSpec = new FacetSpec() { OrderBy = FacetSpec.FacetSortSpec.OrderHitsDesc, MinHitCount = 1 };
	request.SetFacetSpec("category", facetSpec);

	var result = browser.Browse(request);
	Console.WriteLine(string.Format("total hits:{0}", result.NumHits));
	Console.WriteLine("===========================");
	foreach (var facet in result.FacetMap["category"].GetFacets())
	{
		var category = _categories.First(k => k.Value == int.Parse(facet.Value.ToString()));
		Console.WriteLine("{0}:({1})", category.Key, facet.FacetValueHitCount);
	}
	Console.WriteLine("===========================");
	for (var i = 0; i < result.Hits.Length; i++)
	{
		var doc = browser.Doc(result.Hits[i].DocId);
		var category = _categories.First(k => k.Value == int.Parse(doc.GetField("category").StringValue)).Key;
		Console.WriteLine(string.Format("{2} - {0} ${1} by {3}", doc.GetField("name").StringValue, doc.GetField("price").StringValue, category, doc.GetField("author").StringValue));
	}
}

output:

total hits:6
===========================
C#:(3)
WEB:(2)
AJAX:(1)
===========================
WEB - Bootstrap for ASP.NET MVC $11.49 by Pieter van der Westhuizen
WEB - Mobile ASP.NET MVC 5 $19.79 by Eric Sowell
C# - ASP.NET Web API 2: Building a REST Service from Start to Finish $23.45 by Jamie Kurtz , Brian Wortman
C# - Pro ASP.NET MVC 5 $27.49 by Adam Freeman
AJAX - Professional ASP.NET 3.5 AJAX $33.29 by Bill Evjen
C# - Designing Evolvable Web APIs with ASP.NET $33.34 by Pablo Cibraro

###Demo###

See the Car Demo in the source code for an ASP.NET MVC based example how Bobo-Browse.Net can be used to provide faceted drill-down search capability.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.