GithubHelp home page GithubHelp logo

lucene-demo-1's Introduction

lucene-demo

解密搜索引擎技术实战Lucene&Java精华版第三版学习手敲代码

1.代码基本上是书上写的,有些不一样,我用的jar包版本皆选取当前最新的版本

比如2.3.1节:

HttpClient的DefaultHttpClient类已经过时了,我采用了新的CloseableHttpClient类代替

2.在书上代码练习的同时,我也自己试着用不同方式来实现同一种方法

比如2.3.2节:

书上使用套接字发送If-Modified-Since头信息:

outw.print("GET " + file + " HTTP/1.0\r\n");
outw.print("If-Modified-Since: Thu, 13 Apr 2017 09:25:12 GMT\r\n");

我尝试了使用HttpClient来实现该功能:

CloseableHttpClient client = HttpClients.createDefault();
	HttpGet get = new HttpGet(path);
	get.addHeader(new Header() { // 这里的Header并不是deader请求,而是头信息参数
		@Override
		public String getValue() {
			return "Thu, 13 Apr 2017 09:25:12 GMT";
		}
		@Override
		public String getName() {
			return "If-Modified-Since";
		}
		@Override
		public HeaderElement[] getElements() throws ParseException {
			return null;
		}
	});
	CloseableHttpResponse httpResponse = client.execute(get);	

lucene-demo-1's People

Contributors

shengchenglong avatar

Watchers

James Cloos avatar

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.